compose.yaml.j2 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. services:
  2. {{ service_name }}:
  3. image: docker.io/gitlab/gitlab-ce:18.5.1-ce.0
  4. container_name: {{ container_name }}
  5. shm_size: '256m'
  6. {% if traefik_enabled %}
  7. networks:
  8. - {{ traefik_network }}
  9. {% endif %}
  10. volumes:
  11. - ./config/gitlab.rb:/etc/gitlab/gitlab.rb:ro
  12. - gitlab-config:/etc/gitlab
  13. - gitlab-logs:/var/log/gitlab
  14. - gitlab-data:/var/opt/gitlab
  15. {% if ports_enabled %}
  16. ports:
  17. - "{{ ports_http }}:80"
  18. - "{{ ports_ssh }}:22"
  19. {% if registry_enabled %}
  20. - "{{ ports_registry }}:5678"
  21. {% endif %}
  22. {% else %}
  23. ports:
  24. - "{{ ports_ssh }}:22"
  25. {% endif %}
  26. {% if traefik_enabled %}
  27. labels:
  28. - traefik.enable=true
  29. - traefik.docker.network={{ traefik_network }}
  30. - traefik.http.services.{{ container_name }}.loadbalancer.server.port=80
  31. - traefik.http.services.{{ container_name }}.loadbalancer.server.scheme=http
  32. - traefik.http.routers.{{ container_name }}-http.service={{ container_name }}
  33. - traefik.http.routers.{{ container_name }}-http.rule=Host(`{{ traefik_host }}`)
  34. - traefik.http.routers.{{ container_name }}-http.entrypoints={{ traefik_entrypoint }}
  35. {% if traefik_tls_enabled %}
  36. - traefik.http.routers.{{ container_name }}-https.service={{ container_name }}
  37. - traefik.http.routers.{{ container_name }}-https.rule=Host(`{{ traefik_host }}`)
  38. - traefik.http.routers.{{ container_name }}-https.entrypoints={{ traefik_tls_entrypoint }}
  39. - traefik.http.routers.{{ container_name }}-https.tls=true
  40. - traefik.http.routers.{{ container_name }}-https.tls.certresolver={{ traefik_tls_certresolver }}
  41. {% endif %}
  42. {% if registry_enabled %}
  43. - traefik.http.services.{{ container_name }}-registry.loadbalancer.server.port={{ ports_registry }}
  44. - traefik.http.services.{{ container_name }}-registry.loadbalancer.server.scheme=http
  45. - traefik.http.routers.{{ container_name }}-registry-http.service={{ container_name }}-registry
  46. - traefik.http.routers.{{ container_name }}-registry-http.rule=Host(`{{ traefik_registry_host }}`)
  47. - traefik.http.routers.{{ container_name }}-registry-http.entrypoints={{ traefik_entrypoint }}
  48. {% if traefik_tls_enabled %}
  49. - traefik.http.routers.{{ container_name }}-registry-https.service={{ container_name }}-registry
  50. - traefik.http.routers.{{ container_name }}-registry-https.rule=Host(`{{ traefik_registry_host }}`)
  51. - traefik.http.routers.{{ container_name }}-registry-https.entrypoints={{ traefik_tls_entrypoint }}
  52. - traefik.http.routers.{{ container_name }}-registry-https.tls=true
  53. - traefik.http.routers.{{ container_name }}-registry-https.tls.certresolver={{ traefik_tls_certresolver }}
  54. {% endif %}
  55. {% endif %}
  56. {% endif %}
  57. restart: {{ restart_policy }}
  58. volumes:
  59. gitlab-config:
  60. driver: local
  61. gitlab-logs:
  62. driver: local
  63. gitlab-data:
  64. driver: local
  65. {% if traefik_enabled %}
  66. networks:
  67. {{ traefik_network }}:
  68. external: true
  69. {% endif %}