---

# sources:
# - https://docs.gitlab.com/ee/install/docker.html#install-gitlab-using-docker-compose

version: '3.6'
secrets:
  gitlab_root_password:
    file: ./gitlab_root_password.txt
services:
  gitlab:
    container_name: gitlab
    image: gitlab/gitlab-ce:16.11.2-ce.0
    restart: unless-stopped
    hostname: gitlab.lan
    environment:
      GITLAB_OMNIBUS_CONFIG:
        # add any other gitlab.rb configuration here, each on its own line
        # https not accepteb y Let's Encrypt on .lan (not a valid public domain)
        |
        external_url 'http://gitlab.lan'
        gitlab_rails['initial_root_password'] = File.read('/run/secrets/gitlab_root_password').gsub("\n", "")
    ports:
      - '8022:22'
      - '8080:80'
      - '8443:443'
    volumes:
      - ${PWD}/config:/etc/gitlab:Z
      - ${PWD}/data:/var/opt/gitlab:Z
      - ${PWD}/logs:/var/log/gitlab:Z
    shm_size: 256m
    secrets:
      - gitlab_root_password
    # healthcheck:
    #   test: >-
    #     test $(
    #       curl --fail --insecure --location --output '/dev/null' --silent --show-error --write-out "%{http_code}"
    #         'http://localhost/'
    #     ) -eq 200 || exit 1
    #   interval: 60s
    #   timeout: 3s
    #   retries: 3
    #   start_period:
    #     # it might take longer
    #     # also keep an eye out for permission errors
    #     300s
