Files
jiu/deploy/runner/docker-compose.forgejo.yml
T
wangjia 21088fc908
Deploy / deploy (push) Has been cancelled
feat(deploy): 新增 Forgejo NAS 自托管 Git + CI/CD 配置
- deploy/runner/docker-compose.forgejo.yml:Forgejo + act_runner,ROOT_URL 参数化
- .gitea/workflows/ci.yml:非 main 分支测试
- .gitea/workflows/deploy.yml:main 推送自动构建、创建 Forgejo Release、部署到 EC2
- .gitea/workflows/backup.yml:每日 02:00 备份 MySQL 到 NAS /volume1/backups

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-30 22:09:00 +08:00

54 lines
1.9 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.
# 群晖 NAS 自托管 Forgejo + act_runner
#
# 使用方法:
# 1. 在同目录创建 .env(不要提交到 git),填入以下变量:
# FORGEJO_ROOT_URL=http://192.168.1.x:3000
# NAS_IP=192.168.1.x
# RUNNER_TOKEN=(第5步获取)
# 2. 将 act-runner-config.yaml 复制到 NAS
# /volume1/docker/forgejo/runner/config.yaml
# 3. Container Manager 导入此文件并启动(或 docker compose up -d
# 4. 浏览器访问 http://NAS-IP:3000 完成 Forgejo 初始化(创建管理员账号)
# 5. 站点管理 → 配置 → 开启 Actions
# 仓库 Settings → Actions → Runners → 获取注册 Token → 填入 .env RUNNER_TOKEN
# 6. 重启 act-runner 容器完成 Runner 注册
#
# 本地访问:http://NAS-IP:3000
# Git SSH ssh://git@NAS-IP:2222/用户名/jiu.git
services:
forgejo:
image: codeberg.org/forgejo/forgejo:latest
container_name: forgejo
restart: always
environment:
USER_UID: 1000
USER_GID: 1000
FORGEJO__actions__ENABLED: "true"
FORGEJO__server__ROOT_URL: ${FORGEJO_ROOT_URL:-http://localhost:3000}
FORGEJO__server__SSH_DOMAIN: ${NAS_IP:-localhost}
FORGEJO__server__SSH_PORT: 2222
ports:
- "3000:3000"
- "2222:22"
volumes:
- /volume1/docker/forgejo/data:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
act-runner:
image: gitea/act_runner:latest # Forgejo 兼容 Gitea act_runner
container_name: forgejo-act-runner
restart: always
depends_on:
- forgejo
environment:
CONFIG_FILE: /data/config.yaml
GITEA_INSTANCE_URL: http://forgejo:3000 # Docker 内部通信
GITEA_RUNNER_REGISTRATION_TOKEN: ${RUNNER_TOKEN}
GITEA_RUNNER_NAME: nas-runner
volumes:
- /volume1/docker/forgejo/runner:/data
- /var/run/docker.sock:/var/run/docker.sock
- /volume1/backups:/volume1/backups