# ---------------------------------------------------------------------------- #
## \file docker-compose.yml
## \author Sebastien Beaugrand
## \sa http://beaugrand.chez.com/
## \copyright CeCILL 2.1 Free Software license
# ---------------------------------------------------------------------------- #
services:
  registry:
    # https://hub.docker.com/_/registry
    # source https://github.com/distribution/distribution-library-image
    image: registry:2
    restart: unless-stopped
    container_name: registry
    hostname: registry.{{ domain }}
    ports:
      - 0.0.0.0:5000:5000
    volumes:
      - /mnt/registry:/var/lib/registry
  gitlab:
    # https://hub.docker.com/r/gitlab/gitlab-ce
    # doc https://docs.gitlab.com/ee/install/docker/installation.html
    # source https://gitlab.com/gitlab-org/gitlab
    image: gitlab/gitlab-ce:17.4.2-ce.0
    restart: unless-stopped
    container_name: gitlab
    hostname: gitlab.internal
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        gitlab_rails['initial_root_password'] = '{{ passwd }}'
    ports:
      - 0.0.0.0:2222:22
    volumes:
      - /mnt/gitlab-config:/etc/gitlab
      - /mnt/gitlab-data:/var/opt/gitlab
      - /mnt/gitlab-logs:/var/log/gitlab
    shm_size: 256m
  gitlab-runner:
    # https://hub.docker.com/r/gitlab/gitlab-runner
    # doc https://docs.gitlab.com/runner/install/docker.html
    # source https://gitlab.com/gitlab-org/gitlab-runner
    image: gitlab/gitlab-runner:ubuntu-v17.4.0
    restart: unless-stopped
    container_name: gitlab-runner
    hostname: gitlab-runner.{{ domain }}
    volumes:
      - /mnt/gitlab-runner:/etc/gitlab-runner
      - /var/run/docker.sock:/var/run/docker.sock
      - /mnt/nginx/gitlab.{{ domain }}.crt:/etc/ssl/certs/gitlab.{{ domain }}.crt
    depends_on:
      - registry
      - gitlab
  nginx:
    # https://hub.docker.com/_/nginx
    # source https://github.com/nginxinc/docker-nginx
    image: nginx:1.27.4
    restart: unless-stopped
    container_name: nginx
    hostname: nginx.{{ domain }}
    ports:
      - 0.0.0.0:80:80
      - 0.0.0.0:443:443
    volumes:
      - /mnt/nginx/proxy.conf:/etc/nginx/conf.d/proxy.conf
      - /mnt/nginx/proxy_params:/etc/nginx/proxy_params
      - /mnt/nginx/gitlab.{{ domain }}.crt:/etc/ssl/certs/gitlab.{{ domain }}.crt
    links:
      - gitlab