A spare-machine Gitea forge, hardened, backed up and with CI, as a template. Personal values are placeholders listed in the README.
87 lines
2.9 KiB
YAML
87 lines
2.9 KiB
YAML
services:
|
|
gitea:
|
|
image: gitea/gitea:1.23
|
|
container_name: gitea
|
|
environment:
|
|
- USER_UID=1000
|
|
- USER_GID=1000
|
|
- GITEA__database__DB_TYPE=sqlite3
|
|
- GITEA__database__PATH=/data/gitea/gitea.db
|
|
- GITEA__server__DOMAIN=git.example.com
|
|
- GITEA__server__SSH_DOMAIN=git.example.com
|
|
- GITEA__server__SSH_PORT=2222
|
|
- GITEA__server__ROOT_URL=https://git.example.com/
|
|
- GITEA__server__HTTP_PORT=3000
|
|
- GITEA__service__DISABLE_REGISTRATION=true
|
|
- GITEA__service__DEFAULT_KEEP_EMAIL_PRIVATE=true
|
|
# console alone keeps logs in `docker logs` only, leaving
|
|
# /data/gitea/log empty — the fail2ban gitea jail (OKF/guides/09) needs a real
|
|
# file on disk to tail.
|
|
- GITEA__log__MODE=console,file
|
|
# Hardening (OKF/guides/09 §3). Kept here rather than in app.ini: env wins on
|
|
# every container start, so an app.ini edit to these keys is reverted.
|
|
- GITEA__server__LFS_START_SERVER=false
|
|
- GITEA__openid__ENABLE_OPENID_SIGNIN=false
|
|
- GITEA__security__MIN_PASSWORD_LENGTH=12
|
|
- GITEA__security__PASSWORD_COMPLEXITY=lower,upper,digit,spec
|
|
# On by default since 1.21; explicit so the dependency is visible (OKF/guides/12).
|
|
- GITEA__actions__ENABLED=true
|
|
volumes:
|
|
- ./gitea-data:/data
|
|
- /etc/timezone:/etc/timezone:ro
|
|
- /etc/localtime:/etc/localtime:ro
|
|
ports:
|
|
- "127.0.0.1:3000:3000"
|
|
- "0.0.0.0:2222:22"
|
|
restart: unless-stopped
|
|
networks:
|
|
- gitea-net
|
|
|
|
caddy:
|
|
image: caddy:2
|
|
container_name: caddy
|
|
ports:
|
|
- "0.0.0.0:80:80"
|
|
- "0.0.0.0:443:443"
|
|
volumes:
|
|
- ./Caddyfile:/etc/caddy/Caddyfile:ro
|
|
- ./caddy-data:/data
|
|
- ./caddy-config:/config
|
|
restart: unless-stopped
|
|
networks:
|
|
- gitea-net
|
|
- edge
|
|
depends_on:
|
|
- gitea
|
|
|
|
# Gitea Actions runner (OKF/guides/12). Polls Gitea over HTTPS like any outside
|
|
# client and starts each job as a sibling container through the host's
|
|
# Docker socket — root-equivalent, acceptable only because this is a
|
|
# single-user forge with registration disabled.
|
|
runner:
|
|
image: gitea/act_runner:0.6.1
|
|
container_name: runner
|
|
environment:
|
|
- CONFIG_FILE=/config.yaml
|
|
- GITEA_INSTANCE_URL=https://git.example.com
|
|
- GITEA_RUNNER_NAME=mithlond
|
|
# Read only on first start, when runner-data/.runner does not exist yet.
|
|
# Delete the file once registered.
|
|
- GITEA_RUNNER_REGISTRATION_TOKEN_FILE=/data/registration-token
|
|
volumes:
|
|
- ./runner/config.yaml:/config.yaml:ro
|
|
- ./runner-data:/data
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
restart: unless-stopped
|
|
depends_on:
|
|
- gitea
|
|
|
|
networks:
|
|
gitea-net:
|
|
driver: bridge
|
|
# Shared with an optional second stack on the apex domain (e.g. a portfolio),
|
|
# which declares it the same way. Created once
|
|
# by hand: docker network create edge
|
|
edge:
|
|
external: true
|