Ctrl K
ComunidadGuías…

gitlab/docker-compose.gitlab.yml

Rama main · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
# Robot Dev Team Project
# File: gitlab/docker-compose.gitlab.yml
# Description: Example Docker Compose for GitLab CE with File Hook support.
# License: MIT
# SPDX-License-Identifier: MIT
# Copyright (c) 2025 MCKNLY LLC
#
# This is a reference compose file for running GitLab CE with the
# add_webhooks.rb File Hook mounted for automatic webhook provisioning.
#
# Usage:
#   1. Run from the gitlab/ directory (file_hooks/ is included alongside this file).
#   2. Copy the example env file and fill in ROBOT_WEBHOOK_URL at minimum:
#        cp .env.example .env
#   3. Start GitLab:
#        docker compose -f docker-compose.gitlab.yml up -d
#
#   On first boot, docker-entrypoint-rdt.sh automatically:
#     - Creates an admin PAT using the auto-generated root password.
#     - Enables outbound requests to local/private network addresses.
#   No manual token creation or setup-gitlab.sh run is required.
#
# See readme-gitlab.md in this directory for upgrade guidance.

services:
  gitlab:
    image: gitlab/gitlab-ce:latest
    container_name: gitlab
    hostname: localhost
    restart: unless-stopped
    # Wrap the standard GitLab entrypoint to perform one-time setup on first
    # boot (PAT creation + local webhook delivery setting).
    entrypoint: ["/bin/bash", "/rdt-entrypoint.sh"]
    ports:
      - "8929:80"
      # - "4443:443"
      # - "2222:22"
    volumes:
      - gitlab_config:/etc/gitlab
      - gitlab_logs:/var/log/gitlab
      - gitlab_data:/var/opt/gitlab
      # Entrypoint wrapper — performs first-boot RDT setup automatically.
      - ./docker-entrypoint-rdt.sh:/rdt-entrypoint.sh:ro
      # Mount the File Hooks directory so scripts persist across
      # container restarts and GitLab upgrades.
      - ./file_hooks:/opt/gitlab/embedded/service/gitlab-rails/file_hooks
    env_file:
      - .env
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        # The external_url controls the hostname embedded in git clone URLs,
        # email links, and OAuth redirects that GitLab generates.
        # For local Docker deployments this must be a URL reachable both from
        # the host browser (localhost:8080 still works via port mapping) and
        # from other containers (host.docker.internal resolves to the host via
        # extra_hosts).  Change to your public domain for production.
        external_url '${GITLAB_EXTERNAL_URL}'

        # Keep nginx listening on port 80 inside the container regardless of
        # the port in external_url.  This decouples the clone/link URL port
        # (host-visible) from the internal listen port, so the port mapping
        # 8929:80 stays correct even when external_url specifies port 8929.
        # This is the standard GitLab pattern for reverse-proxy deployments.
        nginx['listen_port'] = 80
        nginx['listen_https'] = false

        # Pass environment variables to the Rails application so
        # the add_webhooks.rb File Hook can read them at runtime.
        # Values are substituted from gitlab/.env by Docker Compose.
        gitlab_rails['env'] = {
          'GITLAB_ADMIN_TOKEN'          => '${GITLAB_ADMIN_TOKEN}',
          'ROBOT_WEBHOOK_URL'           => '${ROBOT_WEBHOOK_URL}',
          'GITLAB_WEBHOOK_SECRET'       => '${GITLAB_WEBHOOK_SECRET}',
          'GITLAB_WEBHOOK_SSL_VERIFY'   => '${GITLAB_WEBHOOK_SSL_VERIFY}'
        }
    # Resolve 'host.docker.internal' to the Docker host on Linux.
    # (Docker Desktop on macOS/Windows provides this automatically.)
    extra_hosts:
      - "host.docker.internal:host-gateway"
    shm_size: "256m"

volumes:
  gitlab_config:
  gitlab_logs:
  gitlab_data: