Files
official-site-base/docker/gitea.docker-compose.yml
T
lzy 60e18ded88 fix(docker): 修复本地 Gitea+act_runner 配置使 CI 可跑通
- 端口 3000→3001(避开 Astro dev server 占用)
- gitea 加 INSTALL_LOCK=true 跳过首装页 + ROOT_URL=http://localhost:3001/
- registration token 两端同步并满足 Gitea ≥32 字符强度要求
- runner 加 GITEA_RUNNER_LABELS 走 docker 模式(node:20-bookworm)
- docker.sock 保持单斜杠(Docker Desktop 实测可用,双斜杠为伪需求)

端到端验证通过:Gitea 1.27 + act_runner v0.6.1,标准 node 镜像
job 经 docker.sock spawn 容器执行成功。需配合 Docker registry
mirror(国内)拉取业务镜像。
2026-07-23 23:03:06 +08:00

37 lines
1.7 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 本地 Phase 0 验证用 Gitea + act_runner
# 用法:cd docker && docker compose -f gitea.docker-compose.yml up -d
# 说明:
# - Gitea Web: http://localhost:3001 (宿主 3001,避开 Astro dev 占用的 3000
# - docker.sock 用单斜杠即可:compose 文件内 YAML 值不经 shell
# Docker Desktop for Windows 下实测可正常访问宿主 daemon(已验证)
# - GITEA_RUNNER_REGISTRATION_TOKEN 在 gitea 与 runner 两端设相同值:
# gitea 启动时将其作为全局 registration tokenrunner 用它完成注册
services:
gitea:
image: gitea/gitea:1
environment:
- USER_UID=1000
- USER_GID=1000
- GITEA__security__INSTALL_LOCK=true # 跳过首装页面,以默认 SQLite 配置启动
- GITEA__server__ROOT_URL=http://localhost:3001/ # 对外访问地址(宿主端口)
- GITEA_RUNNER_REGISTRATION_TOKEN=phase0-local-actions-runner-token-0123456789abcdef0123456789 # 全局 registration token,与 runner 端一致
volumes:
- ./gitea-data:/data
ports:
- "3001:3000" # Web(宿主 3001,避开 Astro dev 占用的 3000
- "2222:22" # SSH
restart: unless-stopped
runner:
image: gitea/act_runner:latest
environment:
- GITEA_INSTANCE_URL=http://gitea:3000
- GITEA_RUNNER_REGISTRATION_TOKEN=phase0-local-actions-runner-token-0123456789abcdef0123456789
- GITEA_RUNNER_LABELS=ubuntu-latest:docker://node:20-bookworm,ubuntu-24.04:docker://node:20-bookworm,ubuntu-22.04:docker://node:20-bookworm
volumes:
- ./runner-data:/data
- /var/run/docker.sock:/var/run/docker.sock
depends_on:
- gitea
restart: unless-stopped