version: "3.9"

services:

  docker-registry:
    image: registry:2.8.1
    container_name: docker-registry
    restart: always
    environment:
      REGISTRY_HTTP_ADDR: 0.0.0.0:5000
    ports:
      - 5000
      - 5000:5000
    volumes:
      - ./volumes/docker-registry:/var/lib/registry

  gitlab:
    image: 'gitlab/gitlab-ee:15.9.2-ee.0'
    container_name: gitlab
    links:
      - docker-registry
    restart: always
    hostname: 'localhost'
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        # root account setup

        gitlab_rails['initial_root_password'] = "${GITLAB_ROOT_PASSWORD}"
        gitlab_rails['gitlab_root_email'] = "${GITLAB_ROOT_EMAIL}"
        
        # network setup
        
        letsencrypt['enable'] = false
        external_url '${GITLAB_IP_OR_DNS}'
        # gitlab_rails['gitlab_https'] = true
        # gitlab_rails['gitlab_port'] = 443

        # container registry setup

        registry_external_url 'http://docker-registry:5000/'
    ports:
      - 0.0.0.0:80:80
      - 0.0.0.0:443:443
      - 0.0.0.0:2222:22
    volumes:
      - ./volumes/gitlab/config:/etc/gitlab
      - ./volumes/gitlab/data:/var/opt/gitlab
      # - ./volumes/gitlab/logs:/var/log/gitlab
    shm_size: '256m'


  gitlab-runner-000:
    image: gitlab/gitlab-runner:alpine3.14-bleeding
    container_name: gitlab-runner-000
    links:
      - gitlab
    volumes:
      - ./volumes/gitlab-runner-000/config:/etc/gitlab-runner
      - ./volumes/gitlab-runner-000/projects:/etc/projects
      - /var/run/docker.sock:/var/run/docker.sock

  gitlab-runner-001:
    image: gitlab/gitlab-runner:alpine3.14-bleeding
    container_name: gitlab-runner-001
    links:
      - gitlab
    volumes:
      - ./volumes/gitlab-runner-001/config:/etc/gitlab-runner
      - ./volumes/gitlab-runner-001/projects:/etc/projects
      - /var/run/docker.sock:/var/run/docker.sock

  gitlab-runner-002:
    image: gitlab/gitlab-runner:alpine3.14-bleeding
    container_name: gitlab-runner-002
    links:
      - gitlab
    volumes:
      - ./volumes/gitlab-runner-002/config:/etc/gitlab-runner
      - ./volumes/gitlab-runner-002/projects:/etc/projects
      - /var/run/docker.sock:/var/run/docker.sock