version: '3.8'
services:
  gitlab:
    image: 'gitlab/gitlab-ce:16.0.1-ce.0'
    container_name: 'gitlab'
    environment:
      GITLAB_URL: 'http://localhost:8080'
      PERSONAL_ACCESS_TOKEN: superstrongpassword123
      GITLAB_OMNIBUS_CONFIG: |
        gitlab_rails['monitoring_whitelist'] = ['0.0.0.0/0', '172.17.0.1'];
      GITLAB_ROOT_PASSWORD: gitbeaker
    entrypoint:
      - '/bin/sh'
      - '-c'
      - "printf '#!/usr/bin/env ruby \nu = User.first \nu.admin = true \nu.save! \nt = PersonalAccessToken.new({ user: u, name: \"gitbeaker\", scopes: [\"api\", \"read_user\"]}) \nt.expires_at = 365.days.from_now \nt.set_token(ENV[\"PERSONAL_ACCESS_TOKEN\"]) \nt.save!  \nputs t.token\n' > /opt/gitlab/embedded/service/gitlab-rails/db/fixtures/production/40_access_token.rb && /assets/wrapper"
    ports:
      - '8080:80'
      - '8443:443'
