The absolute-path + symlink layout added earlier today is awkward to redeploy against: after a fresh clone the symlinks point at nothing and compose quietly creates empty directories in their place, so the service comes up healthy with no history. /root/apps/ holds services only, so the images and the SQLite database live in the project again as ./output and ./data, bind-mounted with relative paths. Backups are handled by a separate hook that copies to /root/backup_files/ai-image/, which is not part of /root/apps/. Both directories stay gitignored.
20 lines
735 B
YAML
20 lines
735 B
YAML
services:
|
|
ai-image:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
ports:
|
|
- "8765:8000"
|
|
env_file:
|
|
- .env
|
|
volumes:
|
|
# 生成物与数据库用项目内相对路径(2026-11-04 还原)。
|
|
# 不用绝对路径也不用符号链接:符号链接在重新 clone/rm -rf 重建后
|
|
# 会指向空气,compose 还会静默创建一个空目录。
|
|
# 注意:/root/apps/ai-image/output 与 /root/apps/ai-image/data 是本服务的
|
|
# 生成物目录,删项目之前先备份(备份脚本见 ruantang profile 的
|
|
# backup-ai-image-output.sh,落到 /root/backup_files/ai-image/)。
|
|
- ./output:/app/output
|
|
- ./data:/app/data
|
|
restart: unless-stopped
|