Files
story-edit-web/web/docker-compose.gitsync.yml

52 lines
2.5 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.

# 极空间 Composestory 事件编辑器 + 自动 git 同步。
# 效果:本机 push 到 Gitea 后,约 1 分钟内 NAS 自动拉取最新代码——
# 前端刷新浏览器即生效;后端(app.py/db.py/ir_core)由 uvicorn --reload 自动重启生效
# (整仓库挂到 /app + STORY_WEB_RELOAD=1。仅改 requirements.txt/环境变量才需重建镜像。
#
# 用法:极空间 Docker →「Compose / 项目」→ 新建 → 粘贴本文件 → 改下面标 ← 的 2~3 处 → 部署。
# 首次部署前:先停止并删除原来的单容器 story-event-web数据在 /data 目录,删容器不丢)。
services:
# ① 同步器:每 60s 把 Gitea 上的最新仓库强制同步到共享目录 /repo
story-gitsync:
image: alpine/git
container_name: story-gitsync
restart: unless-stopped
entrypoint: ["/bin/sh", "-c"]
command:
- >
git config --global --add safe.directory /repo;
cd /repo;
if [ ! -d .git ]; then
git init -q;
git remote add origin https://git.xindiegaming.top/bia/story-edit-web.git;
fi;
while true; do
git fetch -q origin main && git reset --hard -q origin/main;
sleep 60;
done
volumes:
# ← 共享目录:随便选个空目录给同步器用(不存在会自动建)。下面 story-web 要引用同一路径。
- "/SATA存储11/Docker/story-edit-web-src:/repo"
# ② 编辑器本体(沿用已导入的镜像 story-event-web:latest
story-web:
image: story-event-web:latest
container_name: story-event-web
restart: unless-stopped
depends_on: [story-gitsync]
ports:
- "8787:8787"
environment:
# ← 改成实际口令每人一把口令即身份≥8位且互不相同
# 未配置/口令过短/重复时容器启动即退出(拒绝弱口令裸奔)。
STORY_WEB_USERS: "bia:把我改成口令A,ljl:把我改成口令B"
STORY_WEB_RELOAD: "1" # 配合下面整仓库挂载:后端改动 push 后自动重启生效
TZ: "Asia/Shanghai"
volumes:
# ← 事件数据:填你原来单容器 /data 对应的 NAS 目录(务必填对,否则看不到旧数据)
- "/SATA存储11/Docker/story-event-web/data:/data"
# 整个同步仓库盖在 /app只读web/ 前端+后端、ir_core、ir_dictionary.json 全部
# 来自 git 同步目录;镜像内的 COPY 副本只作无挂载时的兜底。路径按上面共享路径,一般不用改。
- "/SATA存储11/Docker/story-edit-web-src:/app:ro"