services: gharp: # Local source build is the default. Run `docker compose pull` first # to use the published image instead, or `docker compose up --build` # to force a rebuild from source. build: . image: ghcr.io/muhac/gharp:1 container_name: gharp restart: unless-stopped env_file: .env # RUNNER_COMMAND uses YAML `>-` so the multi-line source folds to one # line at runtime; .env can't hold multi-line values. environment: # Concurrent runner cap. MAX_CONCURRENT_RUNNERS: "4" # Pin the runner image so reproducibility doesn't depend on # whatever `latest` resolves to today. ubuntu-noble = 24.04. RUNNER_IMAGE: "myoung34/github-runner:ubuntu-noble" RUNNER_WORKDIR_ROOT: /tmp/gharp # Bearer token for the admin/JSON APIs (dashboard, /jobs, /stats, # retry/cancel). Read from the host env or .env (see .env.example). # Empty value = no auth, dashboard fully open. Must be set on any # internet-reachable deployment. ADMIN_TOKEN: "${ADMIN_TOKEN:-}" # Optional: run a periodic maintenance command (e.g. to prune Docker # storage). Both variables must be set together to enable the feature. # MAINTENANCE_COMMAND: '["docker","system","prune","-f","--volumes"]' # MAINTENANCE_INTERVAL: 6h RUNNER_COMMAND: >- [ "docker","run","--rm","-d", "--name","{{.ContainerName}}", "--network=host", "--log-opt","max-size=10m", "--log-opt","max-file=3", "-v","/var/run/docker.sock:/var/run/docker.sock", "-v","/tmp/gharp/{{.ContainerName}}/_work:/tmp/gharp/{{.ContainerName}}/_work", "-e","REPO_URL={{.RepoURL}}", "-e","RUNNER_TOKEN={{.RegistrationToken}}", "-e","RUNNER_NAME={{.RunnerName}}", "-e","LABELS={{.Labels}}", "-e","RUNNER_WORKDIR=/tmp/gharp/{{.ContainerName}}/_work", "-e","EPHEMERAL=1", "{{.Image}}" ] ports: - "${PORT:-8080}:8080" volumes: - /var/run/docker.sock:/var/run/docker.sock - gharp-data:/data # Mount the workdir tree at the same path inside the gharp container # and on the host, so `-v /tmp/gharp/...` sources in RUNNER_COMMAND # resolve identically from both views. - /tmp/gharp:/tmp/gharp volumes: gharp-data: