compose.yaml.j2 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 }}.service={{ container_name }}
  30. - traefik.http.routers.{{ container_name }}.rule=Host(`{{ traefik_host }}`)
  31. - traefik.http.routers.{{ container_name }}.entrypoints={{ traefik_tls_entrypoint }}
  32. - traefik.http.routers.{{ container_name }}.tls=true
  33. - traefik.http.routers.{{ container_name }}.tls.certresolver={{ traefik_tls_certresolver }}
  34. {% if registry_enabled %}
  35. - traefik.http.services.{{ container_name }}-registry.loadbalancer.server.port={{ registry_port }}
  36. - traefik.http.services.{{ container_name }}-registry.loadbalancer.server.scheme=http
  37. - traefik.http.routers.{{ container_name }}-registry.service={{ container_name }}-registry
  38. - traefik.http.routers.{{ container_name }}-registry.rule=Host(`{{ registry_hostname }}`)
  39. - traefik.http.routers.{{ container_name }}-registry.entrypoints={{ traefik_tls_entrypoint }}
  40. - traefik.http.routers.{{ container_name }}-registry.tls=true
  41. - traefik.http.routers.{{ container_name }}-registry.tls.certresolver={{ traefik_tls_certresolver }}
  42. {% endif %}
  43. {% endif %}
  44. restart: {{ restart_policy }}
  45. volumes:
  46. gitlab-config:
  47. driver: local
  48. gitlab-logs:
  49. driver: local
  50. gitlab-data:
  51. driver: local
  52. {% if traefik_enabled %}
  53. networks:
  54. {{ traefik_network }}:
  55. external: true
  56. {% endif %}