feat(github_runner): support shared App credentials and multi-org Compose anchors

- github_runner/docker-compose.yml: add x-runner-common/x-runner-env anchors so org runners can be added per-service without duplicating App credentials in .env; default primary runner to RUNNER_SCOPE=repo and APP_LOGIN=kiskaadee

- github_runner/.env-example: keep .env scoped to shared App ID, base64 key, labels, and personal repo URL
This commit is contained in:
kiskaadee committed 2026-11-23 17:36:36 -05:00
1 parent 1981398cf3
commit 359ee51586
2 files changed
+36 -19

No files matched your search

+3 -5
View File
@@ -1,9 +1,7 @@
# GitHub Actions Runner environment variables (injected at runtime; never commit real credentials) # Shared GitHub App credentials (injected at runtime; never commit real credentials)
GITHUB_RUNNER_NAME=homelab-github-runner
GITHUB_RUNNER_SCOPE=org
GITHUB_RUNNER_ORG_NAME=replace-with-github-org
GITHUB_RUNNER_APP_ID=replace-with-github-app-id GITHUB_RUNNER_APP_ID=replace-with-github-app-id
GITHUB_RUNNER_APP_LOGIN=replace-with-github-app-slug
# Single-line base64-encoded GitHub App PEM private key: base64 -w0 < private-key.pem # Single-line base64-encoded GitHub App PEM private key: base64 -w0 < private-key.pem
GITHUB_RUNNER_APP_PRIVATE_KEY_B64=replace-with-base64-encoded-pem GITHUB_RUNNER_APP_PRIVATE_KEY_B64=replace-with-base64-encoded-pem
GITHUB_RUNNER_LABELS=self-hosted,linux,x64,nix GITHUB_RUNNER_LABELS=self-hosted,linux,x64,nix
# Target personal repo when RUNNER_SCOPE=repo (org runners declare ORG_NAME/APP_LOGIN in docker-compose.yml)
GITHUB_RUNNER_REPO_URL=https://github.com/kiskaadee/replace-with-repo
+33 -14
View File
@@ -1,25 +1,44 @@
x-runner-common: &runner-common
image: ${RUNNER_IMAGE:-github-runner:local}
restart: unless-stopped
environment: &runner-env
EPHEMERAL: ${EPHEMERAL:-true}
RUN_AS_ROOT: "false"
DISABLE_AUTO_UPDATE: ${DISABLE_AUTO_UPDATE:-true}
RUNNER_WORKDIR: /data/work
APP_ID: ${GITHUB_RUNNER_APP_ID:-}
APP_PRIVATE_KEY_B64: ${GITHUB_RUNNER_APP_PRIVATE_KEY_B64:-}
LABELS: ${GITHUB_RUNNER_LABELS:-self-hosted,linux,x64,nix}
services: services:
github_runner: github_runner:
<<: *runner-common
build: . build: .
image: ${RUNNER_IMAGE:-github-runner:local}
container_name: ${CONTAINER_NAME:-github_runner} container_name: ${CONTAINER_NAME:-github_runner}
restart: unless-stopped
environment: environment:
- EPHEMERAL=${EPHEMERAL:-true} <<: *runner-env
- RUN_AS_ROOT=false RUNNER_NAME: ${GITHUB_RUNNER_NAME:-homelab-github-runner}
- DISABLE_AUTO_UPDATE=${DISABLE_AUTO_UPDATE:-true} RUNNER_SCOPE: ${GITHUB_RUNNER_SCOPE:-repo}
- RUNNER_WORKDIR=/data/work APP_LOGIN: ${GITHUB_RUNNER_APP_LOGIN:-kiskaadee}
- RUNNER_NAME=${GITHUB_RUNNER_NAME:-homelab-github-runner} REPO_URL: ${GITHUB_RUNNER_REPO_URL:-}
- RUNNER_SCOPE=${GITHUB_RUNNER_SCOPE:-org} ORG_NAME: ${GITHUB_RUNNER_ORG_NAME:-}
- ORG_NAME=${GITHUB_RUNNER_ORG_NAME:-}
- REPO_URL=${GITHUB_RUNNER_REPO_URL:-}
- APP_ID=${GITHUB_RUNNER_APP_ID:-}
- APP_LOGIN=${GITHUB_RUNNER_APP_LOGIN:-}
- APP_PRIVATE_KEY_B64=${GITHUB_RUNNER_APP_PRIVATE_KEY_B64:-}
- LABELS=${GITHUB_RUNNER_LABELS:-self-hosted,linux,x64,nix}
volumes: volumes:
- ../../var/lib/homelab/github_runner:/data - ../../var/lib/homelab/github_runner:/data
- nix-store:/nix - nix-store:/nix
# To add an organization runner later (reusing the same built image, App ID/key, and nix-store):
# github_runner_canopy:
# <<: *runner-common
# container_name: github_runner_canopy
# environment:
# <<: *runner-env
# RUNNER_NAME: homelab-runner-canopy
# RUNNER_SCOPE: org
# APP_LOGIN: canopy
# ORG_NAME: canopy
# volumes:
# - ../../var/lib/homelab/github_runner/canopy:/data
# - nix-store:/nix
volumes: volumes:
nix-store: {} nix-store: {}