- Update backend Dockerfile to use Rust 1.85 (edition 2024 support) - Add Aliyun mirrors for Alpine packages - Add rsproxy.cn mirror for cargo crates - Enable static OpenSSL linking - Fix frontend Dockerfile to use NEXT_PUBLIC_API_BASE - Add mkdir -p public to ensure public dir exists - Update docker-compose files to use correct env var names - Add docker-compose.deploy.yml for production deployment Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
61 lines
1.6 KiB
YAML
61 lines
1.6 KiB
YAML
version: "3.8"
|
||
|
||
services:
|
||
postgres:
|
||
image: postgres:16-alpine
|
||
container_name: notify-postgres
|
||
restart: unless-stopped
|
||
environment:
|
||
POSTGRES_USER: ${POSTGRES_USER:-notify}
|
||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required}
|
||
POSTGRES_DB: ${POSTGRES_DB:-notify}
|
||
volumes:
|
||
- postgres_data:/var/lib/postgresql/data
|
||
# 生产环境不对外暴露数据库端口
|
||
expose:
|
||
- "5432"
|
||
healthcheck:
|
||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-notify} -d ${POSTGRES_DB:-notify}"]
|
||
interval: 5s
|
||
timeout: 5s
|
||
retries: 5
|
||
|
||
backend:
|
||
build:
|
||
context: ./backend_rust
|
||
dockerfile: Dockerfile
|
||
container_name: notify-backend
|
||
restart: unless-stopped
|
||
depends_on:
|
||
postgres:
|
||
condition: service_healthy
|
||
environment:
|
||
DATABASE_URL: postgresql://${POSTGRES_USER:-notify}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:-notify}
|
||
JWT_SECRET: ${JWT_SECRET:?JWT_SECRET is required}
|
||
BASE_URL: ${BASE_URL:-https://notify.example.com}
|
||
ports:
|
||
- "127.0.0.1:4000:4000"
|
||
volumes:
|
||
- uploads_data:/app/uploads
|
||
|
||
frontend:
|
||
build:
|
||
context: ./frontend
|
||
dockerfile: Dockerfile
|
||
args:
|
||
# 构建时注入 API URL(用于 Next.js 静态优化)
|
||
NEXT_PUBLIC_API_BASE: ${NEXT_PUBLIC_API_BASE:-}
|
||
container_name: notify-frontend
|
||
restart: unless-stopped
|
||
depends_on:
|
||
- backend
|
||
environment:
|
||
# 运行时 API URL(用于 SSR)
|
||
NEXT_PUBLIC_API_BASE: ${NEXT_PUBLIC_API_BASE:-}
|
||
ports:
|
||
- "127.0.0.1:3000:3000"
|
||
|
||
volumes:
|
||
postgres_data:
|
||
uploads_data:
|