From 53b2123ae9615942f0110859de37fdc6bc309fbb Mon Sep 17 00:00:00 2001 From: Jack Date: Wed, 4 Nov 2026 23:48:01 +0800 Subject: [PATCH] chore: move generated images and database outside the git worktree The output/ and data/ directories lived inside this git repo. They are gitignored, so any rebuild of the directory (git clone into a recreated path, rm + clone) silently took the generated images and the SQLite database with it. On 2026-11-04 that cost a full round of regenerated images. The real data now lives in /root/apps/ai-image-data/: output/ generated images, one subdirectory per profile_name data/ ai_image.db + secret.key Bind mounts use absolute paths so the container never depends on symlink resolution. ./output and ./data remain as symlinks for backwards compatibility with existing scripts and skills. Also ignore the symlinks themselves: the directory-form rules do not match them, so git would have picked them up. --- .gitignore | 5 +++++ docker-compose.yml | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index e0a53f3..7cd7a9f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,13 @@ !.env.example # Local runtime data (SQLite + 加密密钥) +# 2026-11-04 起真身已迁到 /root/apps/ai-image-data/(git 工作树外)。 +# 这里的 data/ output/ 只保留为指向新位置的符号链接(方便老路径继续用)。 data/ output/ +# 符号链接本身也别提交(目录形式的规则匹配不到 symlink) +/data +/output .screenshots/ .trae-html-share-packages/ diff --git a/docker-compose.yml b/docker-compose.yml index 4c569e7..3c8cfff 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,6 +8,9 @@ services: env_file: - .env volumes: - - ./output:/app/output - - ./data:/app/data + # 生成物与数据库放在 git 工作树外(/root/apps/ai-image 是 git repo, + # 目录一旦被 clone/rm 重建,未跟踪的生成物会一起消失 —— 2026-11-04 丢过一轮)。 + # 用绝对路径而非 ./output,避免 bind mount 跟随符号链接的歧义。 + - /root/apps/ai-image-data/output:/app/output + - /root/apps/ai-image-data/data:/app/data restart: unless-stopped