compose.yaml.j2 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. services:
  2. {{ service_name | default('gitlab') }}:
  3. image: docker.io/gitlab/gitlab-ce:18.3.1-ce.0
  4. container_name: {{ container_name | default('gitlab') }}
  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_https }}:443"
  19. - "{{ ssh_port }}:22"
  20. {% else %}
  21. ports:
  22. - "{{ ssh_port }}:22"
  23. {% endif %}
  24. {% if traefik_enabled %}
  25. labels:
  26. - traefik.enable=true
  27. - traefik.http.services.{{ container_name }}.loadbalancer.server.port=80
  28. - traefik.http.services.{{ container_name }}.loadbalancer.server.scheme=http
  29. - traefik.http.routers.{{ container_name }}-http.service={{ container_name }}
  30. - traefik.http.routers.{{ container_name }}-http.rule=Host(`{{ traefik_host }}`)
  31. - traefik.http.routers.{{ container_name }}-http.entrypoints={{ traefik_entrypoint | default('web') }}
  32. {% if traefik_tls_enabled %}
  33. - traefik.http.routers.{{ container_name }}-https.service={{ container_name }}
  34. - traefik.http.routers.{{ container_name }}-https.rule=Host(`{{ traefik_host }}`)
  35. - traefik.http.routers.{{ container_name }}-https.entrypoints={{ traefik_tls_entrypoint | default('websecure') }}
  36. - traefik.http.routers.{{ container_name }}-https.tls=true
  37. - traefik.http.routers.{{ container_name }}-https.tls.certresolver={{ traefik_tls_certresolver }}
  38. {% endif %}
  39. {% if registry_enabled %}
  40. - traefik.http.services.{{ container_name }}-registry.loadbalancer.server.port={{ registry_port }}
  41. - traefik.http.services.{{ container_name }}-registry.loadbalancer.server.scheme=http
  42. - traefik.http.routers.{{ container_name }}-registry-http.service={{ container_name }}-registry
  43. - traefik.http.routers.{{ container_name }}-registry-http.rule=Host(`{{ registry_hostname }}`)
  44. - traefik.http.routers.{{ container_name }}-registry-http.entrypoints={{ traefik_entrypoint | default('web') }}
  45. {% if traefik_tls_enabled %}
  46. - traefik.http.routers.{{ container_name }}-registry-https.service={{ container_name }}-registry
  47. - traefik.http.routers.{{ container_name }}-registry-https.rule=Host(`{{ registry_hostname }}`)
  48. - traefik.http.routers.{{ container_name }}-registry-https.entrypoints={{ traefik_tls_entrypoint | default('websecure') }}
  49. - traefik.http.routers.{{ container_name }}-registry-https.tls=true
  50. - traefik.http.routers.{{ container_name }}-registry-https.tls.certresolver={{ traefik_tls_certresolver }}
  51. {% endif %}
  52. {% endif %}
  53. {% endif %}
  54. restart: {{ restart_policy }}
  55. volumes:
  56. gitlab-config:
  57. driver: local
  58. gitlab-logs:
  59. driver: local
  60. gitlab-data:
  61. driver: local
  62. {% if traefik_enabled %}
  63. networks:
  64. {{ traefik_network }}:
  65. external: true
  66. {% endif %}