docker: compose 去掉环境变量依赖(值内联),README 同步
- docker-compose.yml 所有 ${VAR:-default} 改为内联写死,无需 .env,直接 docker compose up -d --build
- createbucket 服务保留(借 mc 客户端给 RustFS 建桶,一次性)
- README(中英)改口径:自定义密码/密钥/CORS 直接改 compose 文件
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -143,7 +143,7 @@ Images return OpenAI-style `{ "created": ..., "data": [{ "b64_json": "..." }] }`
|
|||||||
|
|
||||||
> Domain + HTTPS are handled by your own reverse proxy (this project issues no certificates).
|
> Domain + HTTPS are handled by your own reverse proxy (this project issues no certificates).
|
||||||
|
|
||||||
**Docker (recommended)**: `docker compose up -d --build` brings up PostgreSQL + Redis + RustFS + backend + frontend (nginx serving **HTTP on container port 2000**); point your reverse proxy at `http://<host>:2000` (port via `WEB_PORT`; set passwords / keys / `CORS_ORIGINS` in a `.env` beside the compose file, `COOKIE_SECURE=true` when your proxy serves HTTPS).
|
**Docker (recommended)**: `docker compose up -d --build` brings up PostgreSQL + Redis + RustFS + backend + frontend (nginx serving **HTTP on container port 2000**); point your reverse proxy at `http://<host>:2000` (port via `WEB_PORT`; edit the values (passwords / keys / `CORS_ORIGINS`, and `COOKIE_SECURE=true` when your proxy serves HTTPS) directly in `docker-compose.yml`).
|
||||||
|
|
||||||
Or **build from source** — bring your own **PostgreSQL · Redis · RustFS (or any S3) · reverse proxy**:
|
Or **build from source** — bring your own **PostgreSQL · Redis · RustFS (or any S3) · reverse proxy**:
|
||||||
|
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ curl https://你的域名/v1/images/edits \
|
|||||||
|
|
||||||
> 域名 + HTTPS 由你自己的反向代理处理(本项目不内置证书签发)。
|
> 域名 + HTTPS 由你自己的反向代理处理(本项目不内置证书签发)。
|
||||||
|
|
||||||
**Docker(推荐)**:`docker compose up -d --build` 一条命令拉起 PostgreSQL + Redis + RustFS + 后端 + 前端(nginx **HTTP 监听容器 2000 端口**),把你的反向代理指到 `http://<本机>:2000`(端口用 `WEB_PORT` 改;要自定义密码 / 密钥 / `CORS_ORIGINS` 就在 compose 同目录建 `.env` 配,反代走 HTTPS 时设 `COOKIE_SECURE=true`)。
|
**Docker(推荐)**:`docker compose up -d --build` 一条命令拉起 PostgreSQL + Redis + RustFS + 后端 + 前端(nginx **HTTP 监听容器 2000 端口**),把你的反向代理指到 `http://<本机>:2000`(端口用 `WEB_PORT` 改;要改密码 / 密钥 / `CORS_ORIGINS`(反代走 HTTPS 时把 `COOKIE_SECURE` 设为 `true`),直接改 `docker-compose.yml` 里对应值即可)。
|
||||||
|
|
||||||
也可**从源码手动构建**,自备 **PostgreSQL · Redis · RustFS(或任意 S3)· 反向代理**:
|
也可**从源码手动构建**,自备 **PostgreSQL · Redis · RustFS(或任意 S3)· 反向代理**:
|
||||||
|
|
||||||
|
|||||||
+22
-22
@@ -1,17 +1,17 @@
|
|||||||
# image2api — one-command stack: PostgreSQL + Redis + RustFS (S3) + backend
|
# image2api — one-command stack: PostgreSQL + Redis + RustFS (S3) + backend
|
||||||
# (pre-built binary) + frontend/nginx (built here, HTTP only on port 2000).
|
# (built from source) + frontend/nginx (HTTP only on port 2000). Self-contained:
|
||||||
# TLS + domain are NOT handled here — put your own reverse proxy in front of the
|
# docker compose up -d --build
|
||||||
# web container (host port ${WEB_PORT:-2000}) and terminate TLS there.
|
# No .env needed — all values are inline below. TLS + domain are handled by YOUR
|
||||||
# 1) cp .env.docker.example .env # 填 密码 / 密钥 / CORS_ORIGINS
|
# OWN reverse proxy in front of the web container (host port 2000).
|
||||||
# 2) docker compose up -d --build
|
# ⚠ Before exposing to production, change the passwords/keys (POSTGRES_PASSWORD,
|
||||||
# Then point your reverse proxy at http://<host>:${WEB_PORT:-2000}.
|
# RUSTFS_ACCESS_KEY/SECRET_KEY) and set CORS_ORIGINS to your real site origin.
|
||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:16-alpine
|
image: postgres:16-alpine
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_DB: vivid_ai
|
POSTGRES_DB: vivid_ai
|
||||||
POSTGRES_USER: postgres
|
POSTGRES_USER: postgres
|
||||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-change-me-postgres}
|
POSTGRES_PASSWORD: change-me-postgres
|
||||||
volumes:
|
volumes:
|
||||||
- pgdata:/var/lib/postgresql/data
|
- pgdata:/var/lib/postgresql/data
|
||||||
healthcheck:
|
healthcheck:
|
||||||
@@ -39,8 +39,8 @@ services:
|
|||||||
rustfs:
|
rustfs:
|
||||||
image: rustfs/rustfs:latest
|
image: rustfs/rustfs:latest
|
||||||
environment:
|
environment:
|
||||||
RUSTFS_ACCESS_KEY: ${S3_ACCESS_KEY:-vividai}
|
RUSTFS_ACCESS_KEY: vividai
|
||||||
RUSTFS_SECRET_KEY: ${S3_SECRET_KEY:-vividai-secret-change-me}
|
RUSTFS_SECRET_KEY: vividai-secret-change-me
|
||||||
RUSTFS_ADDRESS: ":9000"
|
RUSTFS_ADDRESS: ":9000"
|
||||||
RUSTFS_VOLUMES: /data
|
RUSTFS_VOLUMES: /data
|
||||||
volumes:
|
volumes:
|
||||||
@@ -55,10 +55,10 @@ services:
|
|||||||
- rustfs
|
- rustfs
|
||||||
entrypoint: >
|
entrypoint: >
|
||||||
/bin/sh -c "
|
/bin/sh -c "
|
||||||
until mc alias set s3 http://rustfs:9000 ${S3_ACCESS_KEY:-vividai} ${S3_SECRET_KEY:-vividai-secret-change-me}; do
|
until mc alias set s3 http://rustfs:9000 vividai vividai-secret-change-me; do
|
||||||
echo 'waiting for rustfs...'; sleep 2;
|
echo 'waiting for rustfs...'; sleep 2;
|
||||||
done;
|
done;
|
||||||
mc mb -p s3/${S3_BUCKET:-vivid-ai} || true;
|
mc mb -p s3/vivid-ai || true;
|
||||||
echo 'bucket ready';
|
echo 'bucket ready';
|
||||||
"
|
"
|
||||||
restart: "no"
|
restart: "no"
|
||||||
@@ -68,20 +68,20 @@ services:
|
|||||||
context: ./backend
|
context: ./backend
|
||||||
environment:
|
environment:
|
||||||
APP_ENV: production
|
APP_ENV: production
|
||||||
APP_TITLE: ${APP_TITLE:-image2api}
|
APP_TITLE: image2api
|
||||||
HTTP_ADDR: 0.0.0.0:6666
|
HTTP_ADDR: 0.0.0.0:6666
|
||||||
POSTGRES_DSN: host=postgres user=postgres password=${POSTGRES_PASSWORD:-change-me-postgres} dbname=vivid_ai port=5432 sslmode=disable TimeZone=Asia/Shanghai
|
POSTGRES_DSN: host=postgres user=postgres password=change-me-postgres dbname=vivid_ai port=5432 sslmode=disable TimeZone=Asia/Shanghai
|
||||||
REDIS_ADDR: redis:6379
|
REDIS_ADDR: redis:6379
|
||||||
REDIS_PASSWORD: ""
|
REDIS_PASSWORD: ""
|
||||||
REDIS_DB: "0"
|
REDIS_DB: "0"
|
||||||
RUSTFS_ENDPOINT: http://rustfs:9000
|
RUSTFS_ENDPOINT: http://rustfs:9000
|
||||||
RUSTFS_BUCKET: ${S3_BUCKET:-vivid-ai}
|
RUSTFS_BUCKET: vivid-ai
|
||||||
RUSTFS_ACCESS_KEY: ${S3_ACCESS_KEY:-vividai}
|
RUSTFS_ACCESS_KEY: vividai
|
||||||
RUSTFS_SECRET_KEY: ${S3_SECRET_KEY:-vividai-secret-change-me}
|
RUSTFS_SECRET_KEY: vividai-secret-change-me
|
||||||
# Your site origin(s), comma-separated (the URL your reverse proxy serves).
|
# Set to the URL your reverse proxy serves the site on (comma-separated).
|
||||||
CORS_ORIGINS: ${CORS_ORIGINS:-http://localhost:2000}
|
CORS_ORIGINS: http://localhost:2000
|
||||||
# Keep true only if your reverse proxy serves HTTPS; false for plain HTTP.
|
# true only if your reverse proxy serves HTTPS; false for plain HTTP.
|
||||||
COOKIE_SECURE: ${COOKIE_SECURE:-false}
|
COOKIE_SECURE: "false"
|
||||||
volumes:
|
volumes:
|
||||||
- generated:/app/data/generated
|
- generated:/app/data/generated
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -102,9 +102,9 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: ./frontend
|
context: ./frontend
|
||||||
# nginx serves the SPA + proxies the API on container port 2000 (HTTP only).
|
# nginx serves the SPA + proxies the API on container port 2000 (HTTP only).
|
||||||
# Point your own reverse proxy at host:${WEB_PORT:-2000}.
|
# Point your own reverse proxy at host:2000.
|
||||||
ports:
|
ports:
|
||||||
- "${WEB_PORT:-2000}:2000"
|
- "2000:2000"
|
||||||
depends_on:
|
depends_on:
|
||||||
- backend
|
- backend
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|||||||
Reference in New Issue
Block a user