74 lines
1.7 KiB
YAML
74 lines
1.7 KiB
YAML
|
|
version: '3.8'
|
|||
|
|
|
|||
|
|
# 甲辰藏品管理系统 v1.0.0 - Docker 配置
|
|||
|
|
# 使用方式:docker-compose up -d
|
|||
|
|
|
|||
|
|
services:
|
|||
|
|
# PostgreSQL 数据库
|
|||
|
|
postgres:
|
|||
|
|
image: postgres:15-alpine
|
|||
|
|
container_name: jiachenlong-db
|
|||
|
|
restart: unless-stopped
|
|||
|
|
environment:
|
|||
|
|
POSTGRES_DB: zodiac
|
|||
|
|
POSTGRES_USER: postgres
|
|||
|
|
POSTGRES_PASSWORD: postgres
|
|||
|
|
ports:
|
|||
|
|
- "5432:5432"
|
|||
|
|
volumes:
|
|||
|
|
- postgres_data:/var/lib/postgresql/data
|
|||
|
|
healthcheck:
|
|||
|
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|||
|
|
interval: 10s
|
|||
|
|
timeout: 5s
|
|||
|
|
retries: 5
|
|||
|
|
|
|||
|
|
# FastAPI 后端服务
|
|||
|
|
backend:
|
|||
|
|
build:
|
|||
|
|
context: ../backend
|
|||
|
|
dockerfile: Dockerfile
|
|||
|
|
container_name: jiachenlong-backend
|
|||
|
|
restart: unless-stopped
|
|||
|
|
ports:
|
|||
|
|
- "3000:3000"
|
|||
|
|
volumes:
|
|||
|
|
- ../backend/uploads:/app/uploads
|
|||
|
|
- ../static:/app/static
|
|||
|
|
environment:
|
|||
|
|
- DATABASE_URL=postgresql://postgres:postgres@postgres:5432/zodiac
|
|||
|
|
- SECRET_KEY=production-secret-key-change-me
|
|||
|
|
- ACCESS_TOKEN_EXPIRE_MINUTES=60
|
|||
|
|
- PORT=3000
|
|||
|
|
- HOST=0.0.0.0
|
|||
|
|
- DASHSCOPE_API_KEY=sk-your-api-key
|
|||
|
|
depends_on:
|
|||
|
|
postgres:
|
|||
|
|
condition: service_healthy
|
|||
|
|
healthcheck:
|
|||
|
|
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
|
|||
|
|
interval: 30s
|
|||
|
|
timeout: 10s
|
|||
|
|
retries: 3
|
|||
|
|
|
|||
|
|
# Nginx 前端服务
|
|||
|
|
frontend:
|
|||
|
|
image: nginx:alpine
|
|||
|
|
container_name: jiachenlong-frontend
|
|||
|
|
restart: unless-stopped
|
|||
|
|
ports:
|
|||
|
|
- "80:80"
|
|||
|
|
volumes:
|
|||
|
|
- ../frontend/dist:/usr/share/nginx/html:ro
|
|||
|
|
- ../static:/usr/share/nginx/html/static:ro
|
|||
|
|
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
|||
|
|
depends_on:
|
|||
|
|
- backend
|
|||
|
|
|
|||
|
|
volumes:
|
|||
|
|
postgres_data:
|
|||
|
|
|
|||
|
|
networks:
|
|||
|
|
default:
|
|||
|
|
name: jiachenlong-network
|