ci: 重建 Docker 镜像(之前做的一坨)

This commit is contained in:
foxhui
2025-12-20 19:46:50 +08:00
Unverified
parent c09c465209
commit e8123cca5d
4 changed files with 17 additions and 41 deletions
+1 -2
View File
@@ -10,8 +10,7 @@ on:
default: 'Manual build update'
env:
# 请修改为你的 Docker Hub 镜像名称 (格式: 用户名/仓库名)
IMAGE_NAME: foxhui/lmarena-imagen-automator
IMAGE_NAME: foxhui/webai-2api
jobs:
build-and-push:
+8 -26
View File
@@ -32,36 +32,18 @@ RUN npm install -g pnpm && pnpm install --frozen-lockfile
COPY . .
RUN npm run init
# 4. 生成默认配置文件
RUN cp config.example.yaml config.yaml
EXPOSE 3000 5900
# 4. 启动脚本
# 逻辑说明:
# A. 优先检查 /app/data/config.yaml (用户挂载的数据目录)
# - 存在则使用它覆盖 /app/config.yaml
# B. 不存在 (首次运行)
# - 复制 config.example.yaml 为 config.yaml
# - 立即备份一份到 /app/data/config.yaml 供用户修改
# 5. 启动脚本:同步 data 目录中的配置文件
CMD ["/bin/sh", "-c", "\
if [ -f \"/app/data/config.yaml\" ]; then \
if [ -f /app/data/config.yaml ]; then \
cp /app/data/config.yaml /app/config.yaml; \
else \
echo '>>> First run detected. Generating default config...'; \
cp config.example.yaml config.yaml; \
echo '>>> Exporting default config to /app/data/config.yaml for you...'; \
cp config.yaml /app/data/config.yaml; \
mkdir -p /app/data; \
cp /app/config.yaml /app/data/config.yaml; \
fi; \
\
ARGS='-xvfb -vnc'; \
if [ -n \"$LOGIN_MODE\" ]; then \
if [ \"$LOGIN_MODE\" = \"true\" ]; then \
echo '>>> ENABLED LOGIN MODE'; \
ARGS=\"$ARGS -login\"; \
else \
echo \">>> ENABLED LOGIN MODE for worker: $LOGIN_MODE\"; \
ARGS=\"$ARGS -login:$LOGIN_MODE\"; \
fi; \
fi; \
\
echo \">>> Starting application with args: $ARGS\"; \
npm start -- $ARGS \
npm start -- -xvfb -vnc \
"]
+7 -12
View File
@@ -1,19 +1,14 @@
services:
lmarena-imagen-automator:
image: foxhui/lmarena-imagen-automator:latest
container_name: lmarena-imagen-automator
webai-2api:
image: foxhui/webai-2api:latest
container_name: webai-2api
restart: unless-stopped
ports:
- "3000:3000" # API
- "5900:5900" # VNC
- "3000:3000" # API + WebUI
- "5900:5900" # VNC
volumes:
# 配置文件会自动生成到这里:./data/config.yaml
- ./data:/app/data
- ./data:/app/data # 数据和配置持久化,config.yaml 会自动生成到此目录
environment:
- DISPLAY=:99
# false: 标准挂机模式
# true: 登录第一个 worker
# workerName: 只登录指定的 worker
- LOGIN_MODE=false
shm_size: '2gb'
init: true
init: true
+1 -1
View File
@@ -1,5 +1,5 @@
{
"name": "webai-2-api",
"name": "webai-2api",
"version": "3.0.0",
"description": "基于 Playwright + Camoufox 的自动化图像生成工具",
"license": "MIT",