diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 1112738..68ec8b1 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -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: diff --git a/Dockerfile b/Dockerfile index d172039..e011bd4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 \ "] \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index 715f777..b90c0c8 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -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 \ No newline at end of file + init: true diff --git a/package.json b/package.json index 51d14fb..d3dadd4 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "webai-2-api", + "name": "webai-2api", "version": "3.0.0", "description": "基于 Playwright + Camoufox 的自动化图像生成工具", "license": "MIT",