refactor(cat-bodhi): deploy pinned upstream source
This commit is contained in:
+7
-3
@@ -49,8 +49,12 @@ seaweedfs/data/
|
||||
|
||||
# 忽略 remark42 数据
|
||||
remark42/var/
|
||||
cat-bodhi/data/assets-ai/
|
||||
cat-bodhi/sprite_alpha_seg_pytorch/outputs/
|
||||
# CAT-BODHI is an independently maintained upstream project. Track only its
|
||||
# homelab deployment files; source, models, and runtime data belong elsewhere.
|
||||
cat-bodhi/*
|
||||
!cat-bodhi/.dockerignore
|
||||
!cat-bodhi/Dockerfile
|
||||
!cat-bodhi/compose.yml
|
||||
remark42/.env
|
||||
|
||||
|
||||
@@ -94,4 +98,4 @@ chat/data/
|
||||
|
||||
# 忽略本地诊断输出
|
||||
/0
|
||||
chat/data/
|
||||
chat/data/
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
This repository manages a Docker Compose homelab. The root `compose.yml` defines the shared `homelab_net` network. Each service lives in its own directory with a local Compose file, for example `traefik/compose.yml`, `authentik/compose.yml`, `gitea/compose.yml`, `seaweedfs/compose.yml`, and `chat/compose.yml`. Runtime state and secrets belong in service-local `data/`, `var/`, `letsencrypt/`, `.env`, or similar untracked paths.
|
||||
|
||||
`cat-bodhi/` is the main application code: `index.html`, `game.js`, `styles.css`, `server.mjs`, `assets/`, `data/`, and Python sprite tooling under `tools/` and `sprite_alpha_seg_pytorch/`.
|
||||
`cat-bodhi/` is a deployment stack for the independent CAT-BODHI repository. Its Dockerfile fetches a pinned upstream commit and verifies the archive checksum; do not copy application source or model binaries into this repository. Generated assets and sprite output stay under ignored `cat-bodhi/data/` paths.
|
||||
|
||||
## Build, Test, and Development Commands
|
||||
|
||||
@@ -12,18 +12,18 @@ This repository manages a Docker Compose homelab. The root `compose.yml` defines
|
||||
- `docker compose -f traefik/compose.yml up -d`: start a service stack; swap the path for other services.
|
||||
- `docker compose -f <service>/compose.yml config`: validate a service Compose file before deploying it.
|
||||
- `docker compose -f <service>/compose.yml logs -f`: inspect service logs during troubleshooting.
|
||||
- `cd cat-bodhi && npm run dev`: run the local game and sprite import server on port `8080`.
|
||||
- `cd cat-bodhi && npm run dev:ai:proxy`: run the same server with Node environment proxy support.
|
||||
- `docker compose -f cat-bodhi/compose.yml build`: build the pinned upstream application and model image.
|
||||
- `curl https://cat-bodhi.xiteng.site/api/sprite-status`: verify the deployed model API and required files.
|
||||
|
||||
## Coding Style & Naming Conventions
|
||||
|
||||
Use two-space indentation in YAML, HTML, CSS, and JavaScript. Keep Compose service names, directories, and network aliases lowercase with hyphens, matching paths such as `uptime-kuma` and `outpost-seaweedfs`. Prefer explicit image tags over floating versions. Keep Traefik labels grouped with their service and preserve existing label patterns.
|
||||
|
||||
For `cat-bodhi`, keep the vanilla HTML/CSS/JS structure. Name JavaScript functions and variables in `camelCase`; use descriptive asset filenames such as `decor-cat-bed.png`.
|
||||
For external-source builds such as `cat-bodhi`, pin immutable commit hashes and include a verified archive checksum. Keep runtime mounts limited to persistent output, not source trees.
|
||||
|
||||
## Testing Guidelines
|
||||
|
||||
There is no centralized test suite. Validate infrastructure edits with `docker compose -f <service>/compose.yml config` and, when practical, restart only the affected service. For `cat-bodhi`, run `npm run dev`, open `http://localhost:8080`, and manually verify the changed workflow. If sprite processing changes, verify `/api/sprite-status` and `/api/sprite-import`.
|
||||
There is no centralized test suite. Validate infrastructure edits with `docker compose -f <service>/compose.yml config` and, when practical, restart only the affected service. For `cat-bodhi`, build the image, confirm the container starts cleanly, and require `/api/sprite-status` to report `ready: true` before publishing.
|
||||
|
||||
## Commit & Pull Request Guidelines
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
| Code Server | [code.xiteng.site](https://code.xiteng.site) | Authentik ForwardAuth | 浏览器中的 VS Code 工作台 |
|
||||
| ComfyUI | [comfy.xiteng.site](https://comfy.xiteng.site) | Authentik ForwardAuth | 节点式图像生成工作台 |
|
||||
| InvokeAI | [invoke.xiteng.site](https://invoke.xiteng.site) | Authentik ForwardAuth | 图像生成、画布编辑与模型管理 |
|
||||
| CAT-BODHI | [cat-bodhi.xiteng.site](https://cat-bodhi.xiteng.site) | 无 | 门户中的固定上游版本游戏与 Sprite 模型服务 |
|
||||
| SeaweedFS | [file.xiteng.site](https://file.xiteng.site) | Authentik ForwardAuth | 对象存储 (v4.28) |
|
||||
| SeaweedFS S3 | [s3.xiteng.site](https://s3.xiteng.site) | Access Key | S3 API |
|
||||
| Remark42 | [remark.xiteng.site](https://remark.xiteng.site) | Authentik OAuth2 | 评论系统 |
|
||||
@@ -147,6 +148,10 @@ homelab/
|
||||
├── invokeai/
|
||||
│ ├── compose.yml
|
||||
│ └── data/ # gitignore,模型、配置和生成结果
|
||||
├── cat-bodhi/
|
||||
│ ├── compose.yml # 独立域名部署与门户组件标签
|
||||
│ ├── Dockerfile # 固定并校验 CAT-BODHI 上游归档
|
||||
│ └── data/ # gitignore,生成资源与 Sprite 输出
|
||||
├── outpost/
|
||||
│ ├── compose.yml # Portal Admin / ComfyUI / InvokeAI outpost
|
||||
│ └── ...
|
||||
@@ -187,6 +192,7 @@ docker compose -f chat/compose.yml up -d --build
|
||||
docker compose --env-file code-server/.env -f code-server/compose.yml up -d
|
||||
docker compose -f comfyui/compose.yml up -d
|
||||
docker compose -f invokeai/compose.yml up -d
|
||||
docker compose -f cat-bodhi/compose.yml up -d --build
|
||||
docker compose -f remark42/compose.yml up -d
|
||||
docker compose --env-file .env -f outpost/compose.yml up -d
|
||||
docker compose -f outpost-seaweedfs/compose.yml up -d
|
||||
|
||||
@@ -1,5 +1,2 @@
|
||||
node_modules
|
||||
.git
|
||||
*.md
|
||||
start-local-ai.bat
|
||||
/tmp
|
||||
*
|
||||
!Dockerfile
|
||||
|
||||
+11
-2
@@ -1,3 +1,5 @@
|
||||
# syntax=docker/dockerfile:1.7
|
||||
|
||||
# CAT-BODHI Sprite Segmentation API
|
||||
# Node.js + Python + PyTorch in one container
|
||||
#
|
||||
@@ -11,6 +13,8 @@ FROM python:3.11-slim
|
||||
ARG NODE_MAJOR=22
|
||||
ARG TORCH_INDEX=https://download.pytorch.org/whl/cpu
|
||||
ARG PIP_MIRROR=https://pypi.tuna.tsinghua.edu.cn/simple
|
||||
ARG CAT_BODHI_REF=eaf9d27b4ebe3821da983106a78aa1c745532527
|
||||
ARG CAT_BODHI_ARCHIVE_SHA256=73257f7c9832dd06f958e43cc41d1dccff91788fe49d5384c104d24c75862d4d
|
||||
|
||||
# 中科大 Debian 镜像源
|
||||
RUN sed -i 's|http://deb.debian.org/debian|https://mirrors.ustc.edu.cn/debian|g' /etc/apt/sources.list.d/debian.sources \
|
||||
@@ -35,8 +39,13 @@ RUN pip install --no-cache-dir \
|
||||
Pillow
|
||||
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
RUN mkdir -p assets/ai/cats assets/ai/beads
|
||||
RUN curl -fL --retry 5 --retry-all-errors --connect-timeout 20 \
|
||||
"https://codeload.github.com/ziyuezhou1/CAT-BODHI/tar.gz/${CAT_BODHI_REF}" \
|
||||
-o /tmp/cat-bodhi.tar.gz \
|
||||
&& echo "${CAT_BODHI_ARCHIVE_SHA256} /tmp/cat-bodhi.tar.gz" | sha256sum -c - \
|
||||
&& tar -xzf /tmp/cat-bodhi.tar.gz --strip-components=1 -C /app \
|
||||
&& rm /tmp/cat-bodhi.tar.gz \
|
||||
&& mkdir -p assets/ai/cats assets/ai/beads
|
||||
|
||||
EXPOSE 8080
|
||||
ENV PORT=8080
|
||||
|
||||
+13
-8
@@ -2,22 +2,24 @@ services:
|
||||
cat-bodhi:
|
||||
build:
|
||||
context: .
|
||||
# GPU 加速:取消下面注释(需先安装 nvidia-container-toolkit)
|
||||
# args:
|
||||
# TORCH_INDEX: https://download.pytorch.org/whl/cu126
|
||||
args:
|
||||
CAT_BODHI_REF: eaf9d27b4ebe3821da983106a78aa1c745532527
|
||||
CAT_BODHI_ARCHIVE_SHA256: 73257f7c9832dd06f958e43cc41d1dccff91788fe49d5384c104d24c75862d4d
|
||||
# GPU 加速:取消下面注释(需先安装 nvidia-container-toolkit)
|
||||
# TORCH_INDEX: https://download.pytorch.org/whl/cu126
|
||||
container_name: cat-bodhi
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
- PORT=8080
|
||||
- SPRITE_SEG_ROOT=/opt/sprite_alpha_seg_pytorch
|
||||
- SPRITE_SEG_ROOT=/app/sprite_alpha_seg_pytorch
|
||||
- SPRITE_SEG_PYTHON=/usr/local/bin/python
|
||||
- SPRITE_SEG_CHECKPOINT=/opt/sprite_alpha_seg_pytorch/checkpoints/unet_sprite_ft.pt
|
||||
- SPRITE_SEG_OUT_DIR=/opt/sprite_alpha_seg_pytorch/outputs/cat_match
|
||||
- SPRITE_SEG_CHECKPOINT=/app/sprite_alpha_seg_pytorch/checkpoints/unet_sprite_ft.pt
|
||||
- SPRITE_SEG_OUT_DIR=/app/sprite_alpha_seg_pytorch/outputs/cat_match
|
||||
volumes:
|
||||
# 模型文件目录(需要手动放入 infer_spritesheet_hybrid.py + checkpoints/)
|
||||
- ./sprite_alpha_seg_pytorch:/opt/sprite_alpha_seg_pytorch:rw
|
||||
# 模型与推理代码来自固定的上游提交,只有生成结果需要持久化。
|
||||
- ./data/sprite-output:/app/sprite_alpha_seg_pytorch/outputs:rw
|
||||
# AI 生成图片持久化(可选,不挂载则容器重启后丢失)
|
||||
- ./data/assets-ai:/app/assets/ai:rw
|
||||
networks:
|
||||
@@ -66,6 +68,9 @@ services:
|
||||
- "xiteng.site.component.cat-bodhi.navigation=new-tab"
|
||||
- "xiteng.site.component.cat-bodhi.portal-link=embedded"
|
||||
|
||||
- "org.opencontainers.image.source=https://github.com/ziyuezhou1/CAT-BODHI"
|
||||
- "org.opencontainers.image.revision=eaf9d27b4ebe3821da983106a78aa1c745532527"
|
||||
|
||||
networks:
|
||||
homelab_net:
|
||||
external: true
|
||||
|
||||
Reference in New Issue
Block a user