Files
image2api/docker-compose.yml
T
chiyiandClaude Opus 4.8 6acc428e74 docker: 前端 nginx HTTP :2000(外部反代接管域名/TLS,不再内置证书);README + logo
- docker-compose.yml:去 acme,web 端口 2000(WEB_PORT),CORS_ORIGINS/COOKIE_SECURE 直配,清理证书 volumes
- frontend nginx 模板/Dockerfile:纯 HTTP :2000,删自签证书 + cert-watch 入口脚本
- 删除 install.sh、.env.docker.example(compose 直接 up,不再需要一键脚本/模板)
- README(中英):部署改为 Docker(2000端口反代)+ 源码两法;去 acme/自动 HTTPS 表述;结构/徽章同步;顶部加 Vivid logo(favicon.svg);视频 720p/1080p 分辨率对照表(DocsView)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-01 09:58:59 +08:00

117 lines
3.7 KiB
YAML

# image2api — one-command stack: PostgreSQL + Redis + RustFS (S3) + backend
# (pre-built binary) + frontend/nginx (built here, HTTP only on port 2000).
# TLS + domain are NOT handled here — put your own reverse proxy in front of the
# web container (host port ${WEB_PORT:-2000}) and terminate TLS there.
# 1) cp .env.docker.example .env # 填 密码 / 密钥 / CORS_ORIGINS
# 2) docker compose up -d --build
# Then point your reverse proxy at http://<host>:${WEB_PORT:-2000}.
services:
postgres:
image: postgres:16-alpine
environment:
POSTGRES_DB: vivid_ai
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-change-me-postgres}
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d vivid_ai"]
interval: 5s
timeout: 5s
retries: 10
restart: unless-stopped
redis:
image: redis:7-alpine
command: ["redis-server", "--appendonly", "yes"]
volumes:
- redisdata:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 10
restart: unless-stopped
# RustFS — S3-compatible object storage. The backend talks plain S3 (v4-signed)
# on port 9000. Media is served (cookie-authed) via the backend's /images
# proxy, so the bucket stays private.
rustfs:
image: rustfs/rustfs:latest
environment:
RUSTFS_ACCESS_KEY: ${S3_ACCESS_KEY:-vividai}
RUSTFS_SECRET_KEY: ${S3_SECRET_KEY:-vividai-secret-change-me}
RUSTFS_ADDRESS: ":9000"
RUSTFS_VOLUMES: /data
volumes:
- rustfsdata:/data
restart: unless-stopped
# One-shot: wait for RustFS, create the bucket, then exit. mc (the MinIO client)
# speaks S3 so it works against RustFS too.
createbucket:
image: minio/mc:latest
depends_on:
- rustfs
entrypoint: >
/bin/sh -c "
until mc alias set s3 http://rustfs:9000 ${S3_ACCESS_KEY:-vividai} ${S3_SECRET_KEY:-vividai-secret-change-me}; do
echo 'waiting for rustfs...'; sleep 2;
done;
mc mb -p s3/${S3_BUCKET:-vivid-ai} || true;
echo 'bucket ready';
"
restart: "no"
backend:
build:
context: ./backend
environment:
APP_ENV: production
APP_TITLE: ${APP_TITLE:-image2api}
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
REDIS_ADDR: redis:6379
REDIS_PASSWORD: ""
REDIS_DB: "0"
RUSTFS_ENDPOINT: http://rustfs:9000
RUSTFS_BUCKET: ${S3_BUCKET:-vivid-ai}
RUSTFS_ACCESS_KEY: ${S3_ACCESS_KEY:-vividai}
RUSTFS_SECRET_KEY: ${S3_SECRET_KEY:-vividai-secret-change-me}
# Your site origin(s), comma-separated (the URL your reverse proxy serves).
CORS_ORIGINS: ${CORS_ORIGINS:-http://localhost:2000}
# Keep true only if your reverse proxy serves HTTPS; false for plain HTTP.
COOKIE_SECURE: ${COOKIE_SECURE:-false}
volumes:
- generated:/app/data/generated
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
createbucket:
condition: service_completed_successfully
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:6666/health"]
interval: 10s
timeout: 5s
retries: 10
restart: unless-stopped
web:
build:
context: ./frontend
# nginx serves the SPA + proxies the API on container port 2000 (HTTP only).
# Point your own reverse proxy at host:${WEB_PORT:-2000}.
ports:
- "${WEB_PORT:-2000}:2000"
depends_on:
- backend
restart: unless-stopped
volumes:
pgdata:
redisdata:
rustfsdata:
generated: