Files
notify/docker-compose.prod.yml
Michael Dong faf9f3abcf Fix Docker configuration for deployment
- 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>
2026-02-05 18:35:45 +08:00

61 lines
1.6 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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: