Files
story-edit-web/web/docker-compose.gitsync.yml
2026-06-08 16:53:10 +08:00

46 lines
2.0 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 自动拉取最新前端,浏览器刷新即生效。
#
# 用法:极空间 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:
STORY_WEB_PASSWORD: "change-me" # ← 改成你的共享口令
TZ: "Asia/Shanghai"
volumes:
# ← 事件数据:填你原来单容器 /data 对应的 NAS 目录(务必填对,否则看不到旧数据)
- "/SATA存储11/Docker/story-event-web/data:/data"
# 前端静态:直接取自同步器拉下来的仓库子目录(只读)。这条按上面的共享路径,一般不用改。
- "/SATA存储11/Docker/story-edit-web-src/web/static:/app/web/static:ro"