包含: - furniture-3d-system:Next.js 16 全栈应用(资产中心、产品管理、3D装配动画) - autocad-plugin:AutoCAD 家具导出插件源码 - 资产中心改造:编辑弹窗化、删除功能、Toast反馈、自定义Select组件 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
178 lines
4.4 KiB
YAML
178 lines
4.4 KiB
YAML
# ============================================
|
|
# 生产环境 Docker Compose 配置
|
|
# ============================================
|
|
# 使用方法:
|
|
# docker-compose -f docker-compose.prod.yml up -d
|
|
# ============================================
|
|
|
|
version: '3.8'
|
|
|
|
services:
|
|
# PostgreSQL 数据库
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
container_name: furniture3d-postgres
|
|
restart: always
|
|
environment:
|
|
POSTGRES_USER: ${DB_USER:-postgres}
|
|
POSTGRES_PASSWORD: ${DB_PASSWORD:-postgres}
|
|
POSTGRES_DB: ${DB_NAME:-furniture3d}
|
|
# 性能优化参数
|
|
POSTGRES_INITDB_ARGS: "--encoding=UTF8 --locale=C"
|
|
ports:
|
|
- "${DB_PORT:-5432}:5432"
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
- ./backups/database:/backups
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-postgres} -d ${DB_NAME:-furniture3d}"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 30s
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '2'
|
|
memory: 2G
|
|
reservations:
|
|
cpus: '0.5'
|
|
memory: 512M
|
|
logging:
|
|
driver: "json-file"
|
|
options:
|
|
max-size: "50m"
|
|
max-file: "5"
|
|
networks:
|
|
- furniture3d-network
|
|
|
|
# Redis 缓存
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: furniture3d-redis
|
|
restart: always
|
|
command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru
|
|
ports:
|
|
- "${REDIS_PORT:-6379}:6379"
|
|
volumes:
|
|
- redis_data:/data
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 10s
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '0.5'
|
|
memory: 512M
|
|
reservations:
|
|
cpus: '0.1'
|
|
memory: 128M
|
|
logging:
|
|
driver: "json-file"
|
|
options:
|
|
max-size: "20m"
|
|
max-file: "3"
|
|
networks:
|
|
- furniture3d-network
|
|
|
|
# MinIO 对象存储
|
|
minio:
|
|
image: minio/minio:latest
|
|
container_name: furniture3d-minio
|
|
restart: always
|
|
command: server /data --console-address ":9001"
|
|
environment:
|
|
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-minioadmin}
|
|
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-minioadmin}
|
|
# 生产环境建议启用 TLS
|
|
# MINIO_SERVER_URL: https://minio.yourdomain.com
|
|
ports:
|
|
- "${MINIO_API_PORT:-9000}:9000"
|
|
- "${MINIO_CONSOLE_PORT:-9001}:9001"
|
|
volumes:
|
|
- minio_data:/data
|
|
- ./backups/files:/backups
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
|
|
interval: 30s
|
|
timeout: 20s
|
|
retries: 3
|
|
start_period: 30s
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '1'
|
|
memory: 1G
|
|
reservations:
|
|
cpus: '0.25'
|
|
memory: 256M
|
|
logging:
|
|
driver: "json-file"
|
|
options:
|
|
max-size: "50m"
|
|
max-file: "5"
|
|
networks:
|
|
- furniture3d-network
|
|
|
|
# Next.js 应用(可选,也可以单独部署)
|
|
app:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: furniture3d-app
|
|
restart: always
|
|
environment:
|
|
NODE_ENV: production
|
|
DATABASE_URL: postgresql://${DB_USER:-postgres}:${DB_PASSWORD:-postgres}@postgres:5432/${DB_NAME:-furniture3d}
|
|
S3_ENDPOINT: http://minio:9000
|
|
S3_ACCESS_KEY: ${MINIO_ROOT_USER:-minioadmin}
|
|
S3_SECRET_KEY: ${MINIO_ROOT_PASSWORD:-minioadmin}
|
|
S3_BUCKET: ${S3_BUCKET:-furniture-3d-models}
|
|
JWT_SECRET: ${JWT_SECRET:-your-super-secret-jwt-key-change-in-production}
|
|
REDIS_URL: redis://redis:6379
|
|
ports:
|
|
- "${APP_PORT:-3000}:3000"
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
minio:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:3000/api/health?mode=simple"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 60s
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '2'
|
|
memory: 1G
|
|
reservations:
|
|
cpus: '0.5'
|
|
memory: 512M
|
|
logging:
|
|
driver: "json-file"
|
|
options:
|
|
max-size: "100m"
|
|
max-file: "10"
|
|
networks:
|
|
- furniture3d-network
|
|
|
|
volumes:
|
|
postgres_data:
|
|
driver: local
|
|
redis_data:
|
|
driver: local
|
|
minio_data:
|
|
driver: local
|
|
|
|
networks:
|
|
furniture3d-network:
|
|
driver: bridge
|