inline compose environment for container station

This commit is contained in:
2026-05-09 19:08:21 +08:00
parent 55d1e6b0b4
commit 7d116cea36
4 changed files with 26 additions and 25 deletions

View File

@@ -105,7 +105,7 @@ For Agent-facing image generation and editing instructions, see `API图片绘制
## Docker Compose Deploy
Create `.env.local` first:
For Docker Compose deployment, edit `docker_compose.yaml` and fill the `environment` values:
```env
GEMINI_API_KEY="YOUR_GEMINI_API_KEY"

View File

@@ -6,11 +6,13 @@ services:
container_name: gemini-draw
init: true
restart: unless-stopped
env_file:
- .env.local
environment:
GEMINI_API_KEY: "CHANGE_ME_TO_YOUR_GEMINI_API_KEY"
API_AUTH_TOKEN: "CHANGE_ME_TO_A_LONG_RANDOM_TOKEN"
API_PORT: "3002"
API_AUTH_DISABLED: "false"
APP_PASSWORD: "123456"
APP_URL: "http://localhost:3000"
ports:
- "3000:3000"
- "3002:3002"

View File

@@ -8,17 +8,11 @@ services:
# If your project is in a different folder, update `build.context` below
# or run compose from the project folder and change it to `.`.
#
# First-time setup on NAS:
# First-time setup on NAS source folder:
# cd /share/Container/gemini-drawpicture
# cp .env.example .env.local
# vi .env.local
#
# Required values in .env.local:
# GEMINI_API_KEY="your_gemini_api_key"
# API_AUTH_TOKEN="a_long_random_api_access_token"
# API_AUTH_DISABLED="false"
# APP_PASSWORD="your_web_login_password"
# APP_URL="http://192.168.31.5:4001"
# Container Station validates compose files from /tmp, so do not use
# relative environment-file paths here. Fill values directly below.
#
# Build and start:
# cd /share/Container/gemini-drawpicture
@@ -40,12 +34,14 @@ services:
container_name: gemini-drawpicture
init: true
restart: unless-stopped
env_file:
- .env.local
environment:
# Keep API auth enabled on NAS. Use API_AUTH_TOKEN from .env.local.
# Required business settings.
GEMINI_API_KEY: "CHANGE_ME_TO_YOUR_GEMINI_API_KEY"
API_AUTH_TOKEN: "CHANGE_ME_TO_A_LONG_RANDOM_TOKEN"
API_AUTH_DISABLED: "false"
API_PORT: "3002"
APP_PASSWORD: "CHANGE_ME_TO_YOUR_WEB_PASSWORD"
APP_URL: "http://192.168.31.5:4001"
# Optional proxy settings. Keep them if NAS needs OpenClash/proxy
# to reach Google/Gemini; otherwise comment these lines out.

View File

@@ -12,7 +12,7 @@
## 必须修改的配置
在目标机器项目根目录创建 `.env.local`
如果使用 `npm run dev` / `npm run api` 本地运行,在目标机器项目根目录创建 `.env.local`
```env
GEMINI_API_KEY="你的_Gemini_API_Key"
@@ -32,6 +32,8 @@ APP_URL="http://目标机器IP:3000"
- `APP_PASSWORD`:网页登录密码,默认用户名是 `admin`
- `APP_URL`:前端访问地址,迁移到 NAS 时建议写成 `http://NAS_IP:3000`
如果使用 Docker Compose尤其是在 Container Station 里粘贴 YAML 创建应用,请直接修改 `docker_compose.yaml``docker_compose_Nas.yaml` 里的 `environment` 字段。Container Station 会从 `/tmp` 校验 YAML相对环境文件路径容易被解析到 `/tmp` 并失败,所以当前 compose 文件把必要变量直接写在 `environment` 中。
生成随机 `API_AUTH_TOKEN` 的示例:
```bash
@@ -168,15 +170,16 @@ cd /share/Container/gemini-drawpicture
docker compose -f docker_compose_Nas.yaml up -d --build
```
`.env.local` 示例:
`docker_compose_Nas.yaml``environment` 示例:
```env
GEMINI_API_KEY="你的_Gemini_API_Key"
API_AUTH_TOKEN="你的_API_访问密钥"
API_AUTH_DISABLED="false"
API_PORT="3002"
APP_PASSWORD="你的网页登录密码"
APP_URL="http://192.168.31.5:3000"
```yaml
environment:
GEMINI_API_KEY: "你的_Gemini_API_Key"
API_AUTH_TOKEN: "你的_API_访问密钥"
API_AUTH_DISABLED: "false"
API_PORT: "3002"
APP_PASSWORD: "你的网页登录密码"
APP_URL: "http://192.168.31.5:4001"
```
如果 NAS 上 `3000``3002` 已被占用,就只改 `docker_compose.yaml` 左侧宿主机端口:
@@ -227,7 +230,7 @@ GEMINI_API_KEY="你的_Gemini_API_Key"
x-gemini-api-key: 你的_Gemini_API_Key
```
### 修改 `.env.local` 后没有生效
### 修改环境变量后没有生效
重启容器: