version: '3.5'

networks:
  gitlab-network:
    name: gitlab-network

services:
  gitlab:
    image: '${GITLAB_IMAGE}:${GITLAB_TAG}'
    container_name: 'gitlab-test'
    hostname: 'gitlab.test'
    privileged: true # Just in case https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/1350
    environment:
      GITLAB_ROOT_PASSWORD: 5iveL!fe
      GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN: registration-token
      GITLAB_OMNIBUS_CONFIG: |
        external_url 'http://127.0.0.1:8080'
        registry['enable'] = false
        nginx['redirect_http_to_https'] = false
        nginx['listen_port'] = 80
        nginx['listen_https'] = false
        pages_external_url 'http://pages.gitlab.lxd'
        gitlab_pages['enable'] = true
        gitlab_pages['inplace_chroot'] = true
        prometheus['enable'] = false
        alertmanager['enable'] = false
        node_exporter['enable'] = false
        redis_exporter['enable'] = false
        postgres_exporter['enable'] = false
        pgbouncer_exporter['enable'] = false
        gitlab_exporter['enable'] = false
        letsencrypt['enable'] = false
        gitlab_rails['initial_license_file'] = '/python-gitlab-ci.gitlab-license'
        gitlab_rails['monitoring_whitelist'] = ['0.0.0.0/0']
    entrypoint:
      - /bin/sh
      - -c
      - ruby /create_license.rb && /assets/wrapper
    volumes:
      - ${PWD}/tests/functional/fixtures/create_license.rb:/create_license.rb
    ports:
      - '8080:80'
      - '2222:22'
    networks:
      - gitlab-network

  gitlab-runner:
    image: gitlab/gitlab-runner:latest
    container_name: 'gitlab-runner-test'
    depends_on:
      - gitlab
    networks:
      - gitlab-network
