菜单
本页目录
version: '2.3'

services:
  gitlab-redis:
    container_name: gitlab-redis
    restart: always
    image: redis:6.2
    command:
    - --loglevel warning
    volumes:
    - ./redis/data:/data:Z

  gitlab-postgresql:
    container_name: gitlab-postgresql
    restart: always
    image: sameersbn/postgresql:14-20230628
    volumes:
    - ./postgresql/data:/var/lib/postgresql:Z
    environment:
    - DB_USER=gitlab
    - DB_PASS=password
    - DB_NAME=gitlabhq_production
    - DB_EXTENSION=pg_trgm,btree_gist

  gitlab-server:
    restart: always
    image: sameersbn/gitlab:17.1.1
    container_name: gitlab-server
    depends_on:
    - gitlab-redis
    - gitlab-postgresql
    ports:
    - "10180:80"
    - "10022:22"
    volumes:
    - ./gitlab/data:/home/git/data:Z
    healthcheck:
      test: ["CMD", "/usr/local/sbin/healthcheck"]
      interval: 5m
      timeout: 10s
      retries: 3
      start_period: 5m
    environment:
    - GITLAB_OMNIBUS_CONFIG |
      "gitlab_rails['gitlab_default_locale'] = 'zh_CN'"
      "gitlab_rails['import_sources'] = ['github', 'bitbucket', 'gitlab_project', 'gitlab', 'repo_by_url', 'gitlab_group_export']"
      "gitlab_rails['gitlab_signup_enabled'] = false"
    
    - DEBUG=false

    - DB_ADAPTER=postgresql
    - DB_HOST=gitlab-postgresql
    - DB_PORT=5432
    - DB_USER=gitlab
    - DB_PASS=password
    - DB_NAME=gitlabhq_production

    - REDIS_HOST=gitlab-redis
    - REDIS_PORT=6379

    - TZ=Asia/Shanghai
    - GITLAB_TIMEZONE=Asia/Shanghai

    - GITLAB_HTTPS=false
    - SSL_SELF_SIGNED=false

    - GITLAB_HOST=localhost
    - GITLAB_PORT=10180
    - GITLAB_SSH_PORT=10022
    - GITLAB_RELATIVE_URL_ROOT=
    - GITLAB_SECRETS_DB_KEY_BASE=long-and-random-alphanumeric-string
    - GITLAB_SECRETS_SECRET_KEY_BASE=long-and-random-alphanumeric-string
    - GITLAB_SECRETS_OTP_KEY_BASE=long-and-random-alphanumeric-string

    - GITLAB_ROOT_PASSWORD=admin@2024
    - GITLAB_ROOT_EMAIL=junpzx@163.com

    - GITLAB_BACKUP_SCHEDULE=weekly
    # 自动备份时间,不填则采用默认值,每天备份默认时间为04:00
    # - GITLAB_BACKUP_TIME=01:00
    # 备份保留时间,单位秒
    - GITLAB_BACKUP_EXPIRY=31536000
    

    # 启用或禁用注册
    - GITLAB_IMPERSONATION_ENABLED=false