compose.yaml.j2 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. services:
  2. {{ service_name }}:
  3. image: docker.io/gitlab/gitlab-ce:18.4.2-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.http.services.{{ container_name }}.loadbalancer.server.port=80
  30. - traefik.http.services.{{ container_name }}.loadbalancer.server.scheme=http
  31. - traefik.http.routers.{{ container_name }}-http.service={{ container_name }}
  32. - traefik.http.routers.{{ container_name }}-http.rule=Host(`{{ traefik_host }}`)
  33. - traefik.http.routers.{{ container_name }}-http.entrypoints={{ traefik_entrypoint }}
  34. {% if traefik_tls_enabled %}
  35. - traefik.http.routers.{{ container_name }}-https.service={{ container_name }}
  36. - traefik.http.routers.{{ container_name }}-https.rule=Host(`{{ traefik_host }}`)
  37. - traefik.http.routers.{{ container_name }}-https.entrypoints={{ traefik_tls_entrypoint }}
  38. - traefik.http.routers.{{ container_name }}-https.tls=true
  39. - traefik.http.routers.{{ container_name }}-https.tls.certresolver={{ traefik_tls_certresolver }}
  40. {% endif %}
  41. {% if registry_enabled %}
  42. - traefik.http.services.{{ container_name }}-registry.loadbalancer.server.port={{ ports_registry }}
  43. - traefik.http.services.{{ container_name }}-registry.loadbalancer.server.scheme=http
  44. - traefik.http.routers.{{ container_name }}-registry-http.service={{ container_name }}-registry
  45. - traefik.http.routers.{{ container_name }}-registry-http.rule=Host(`{{ traefik_registry_host }}`)
  46. - traefik.http.routers.{{ container_name }}-registry-http.entrypoints={{ traefik_entrypoint }}
  47. {% if traefik_tls_enabled %}
  48. - traefik.http.routers.{{ container_name }}-registry-https.service={{ container_name }}-registry
  49. - traefik.http.routers.{{ container_name }}-registry-https.rule=Host(`{{ traefik_registry_host }}`)
  50. - traefik.http.routers.{{ container_name }}-registry-https.entrypoints={{ traefik_tls_entrypoint }}
  51. - traefik.http.routers.{{ container_name }}-registry-https.tls=true
  52. - traefik.http.routers.{{ container_name }}-registry-https.tls.certresolver={{ traefik_tls_certresolver }}
  53. {% endif %}
  54. {% endif %}
  55. {% endif %}
  56. restart: {{ restart_policy }}
  57. volumes:
  58. gitlab-config:
  59. driver: local
  60. gitlab-logs:
  61. driver: local
  62. gitlab-data:
  63. driver: local
  64. {% if traefik_enabled %}
  65. networks:
  66. {{ traefik_network }}:
  67. external: true
  68. {% endif %}