This repository was archived by the owner on Aug 22, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
160 lines (142 loc) · 5.24 KB
/
Copy pathdocker-compose.yml
File metadata and controls
160 lines (142 loc) · 5.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
services:
# PostgreSQL database for cache metadata
postgres:
image: postgres:16-alpine
container_name: actions-cache-postgres
environment:
POSTGRES_DB: gha_cache
POSTGRES_USER: cache_user
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeme}
volumes:
- postgres-data:/var/lib/postgresql/data
restart: always
healthcheck:
test: ["CMD-SHELL", "pg_isready -U cache_user -d gha_cache"]
interval: 10s
timeout: 5s
retries: 5
networks:
- runner-network
# MinIO S3-compatible object storage for cache data
minio:
image: quay.io/minio/minio:latest
container_name: actions-cache-minio
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-minio_admin}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-changeme123}
volumes:
- minio-data:/data
ports:
- "9000:9000" # MinIO API
- "9001:9001" # MinIO Web Console
restart: always
healthcheck:
test: ["CMD", "mc", "ready", "local"]
interval: 10s
timeout: 5s
retries: 5
networks:
- runner-network
# Local GitHub Actions cache server for fast caching
actions-cache:
image: ghcr.io/falcondev-oss/github-actions-cache-server:latest
environment:
# API configuration
- API_BASE_URL=http://actions-cache:3000
# Storage backend (S3 via MinIO)
- STORAGE_DRIVER=s3
- STORAGE_S3_BUCKET=gh-actions-cache
- AWS_ACCESS_KEY_ID=${MINIO_ROOT_USER:-minio_admin}
- AWS_SECRET_ACCESS_KEY=${MINIO_ROOT_PASSWORD:-changeme123}
- AWS_ENDPOINT_URL=http://minio:9000
- AWS_REGION=us-east-1
# Database backend (PostgreSQL)
- DB_DRIVER=postgres
- DB_POSTGRES_HOST=postgres
- DB_POSTGRES_PORT=5432
- DB_POSTGRES_DATABASE=gha_cache
- DB_POSTGRES_USER=cache_user
- DB_POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-changeme}
# Cleanup old cache entries (days)
- CACHE_CLEANUP_OLDER_THAN_DAYS=90
- DEBUG=false
ports:
- "3000:3000" # Expose cache server for host network runners
depends_on:
postgres:
condition: service_healthy
minio:
condition: service_healthy
restart: always
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:3000/"]
interval: 10s
timeout: 5s
retries: 5
networks:
- runner-network
# GitHub Actions Runner - scales to multiple replicas
# Scale with: docker compose up --scale github-runner=4
# Or use ./up.sh script which reads RUNNER_REPLICAS from .env
github-runner:
# Build the runner image (no build args needed - DinD is embedded)
build:
context: .
# Load environment variables from .env file
env_file:
- .env
# Runtime environment configuration
environment:
# GitHub repository URL to register runner with
# Format: https://github.com/owner/repo (constructed from GITHUB_REPO env var)
REPO_URL: https://github.com/${GITHUB_REPO}
# Personal Access Token for automatic runner token generation
# Create at: https://github.com/settings/tokens with 'repo' and 'workflow' scopes
ACCESS_TOKEN: ${ACCESS_TOKEN}
# Runner name prefix (will append container hostname for uniqueness)
# Results in names like: myserver-runner-github-runners-github-runner-1
RUNNER_NAME_PREFIX: ${RUNNER_NAME_PREFIX:-docker-runner}
# Runner architecture (x64 or ARM64)
# Leave empty for auto-detection (recommended)
RUNNER_ARCH: ${RUNNER_ARCH:-}
# Local cache server configuration (must end with trailing slash!)
# Runners are on same network, can access via service names
# CUSTOM_ACTIONS_RESULTS_URL is used by the forked runner
ACTIONS_RESULTS_URL: http://actions-cache:3000/
CUSTOM_ACTIONS_RESULTS_URL: http://actions-cache:3000/
# Nx remote caching configuration (enforced at runner level)
# These environment variables enable Nx to use self-hosted S3 cache
# without requiring workflow YAML changes
# Runners can access MinIO via service name on same network
NX_KEY: ${NX_KEY:-}
AWS_ACCESS_KEY_ID: ${MINIO_ROOT_USER:-minio_admin}
AWS_SECRET_ACCESS_KEY: ${MINIO_ROOT_PASSWORD:-changeme123}
AWS_ENDPOINT_URL: http://minio:9000
AWS_REGION: us-east-1
# Disable verbose INFO logging to stdout
ACTIONS_RUNNER_PRINT_LOG_TO_STDOUT: 0
# Docker-in-Docker: Each runner has its own embedded Docker daemon
# This provides complete network isolation - no port conflicts between runners
# Privileged mode is required for running Docker daemon inside container
privileged: true
# Ensure cache server is healthy before starting
depends_on:
actions-cache:
condition: service_healthy
# Automatically restart on failure or reboot
restart: always
# Use bridge network for runner-to-runner isolation
networks:
- runner-network
# Map host.docker.internal to host gateway for accessing cache/minio
extra_hosts:
- "host.docker.internal:host-gateway"
# Named volumes for persistent storage
volumes:
postgres-data:
minio-data:
# Network for service communication
networks:
runner-network:
driver: bridge