包含: - furniture-3d-system:Next.js 16 全栈应用(资产中心、产品管理、3D装配动画) - autocad-plugin:AutoCAD 家具导出插件源码 - 资产中心改造:编辑弹窗化、删除功能、Toast反馈、自定义Select组件 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
164 lines
4.0 KiB
YAML
164 lines
4.0 KiB
YAML
# 3D 家具安装展示系统 - 轻量级模式
|
|
# 适用于: 4-8GB 内存的设备 (Intel N100 等低功耗处理器)
|
|
# 性能目标: 优化资源使用,保证基本功能
|
|
|
|
version: '3.8'
|
|
|
|
services:
|
|
# 前端服务 - Nginx + Next.js 静态资源
|
|
frontend:
|
|
image: furniture-3d-frontend:latest
|
|
container_name: furniture-frontend
|
|
restart: unless-stopped
|
|
ports:
|
|
- "${WEB_PORT:-3000}:80"
|
|
environment:
|
|
- NGINX_WORKER_PROCESSES=2
|
|
- NGINX_WORKER_CONNECTIONS=512
|
|
- ENABLE_GZIP_COMPRESSION=true
|
|
volumes:
|
|
- nginx-cache:/var/cache/nginx
|
|
depends_on:
|
|
backend:
|
|
condition: service_healthy
|
|
networks:
|
|
- furniture-network
|
|
mem_limit: 512m
|
|
cpus: 1.0
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:80/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
# 后端服务 - Next.js API + Prisma
|
|
backend:
|
|
image: furniture-3d-backend:latest
|
|
container_name: furniture-backend
|
|
restart: unless-stopped
|
|
environment:
|
|
- NODE_ENV=production
|
|
- DATABASE_URL=${DATABASE_URL}
|
|
- REDIS_URL=${REDIS_URL}
|
|
- S3_ENDPOINT=${S3_ENDPOINT}
|
|
- S3_BUCKET=${S3_BUCKET}
|
|
- MINIO_USER=${MINIO_USER}
|
|
- MINIO_PASSWORD=${MINIO_PASSWORD}
|
|
# 轻量级性能配置
|
|
- DB_POOL_SIZE=10
|
|
- ENABLE_COMPRESSION=true
|
|
- MAX_CONCURRENT_REQUESTS=20
|
|
- MODEL_CACHE_SIZE=100
|
|
- ENABLE_MEMORY_OPTIMIZATION=true
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_started
|
|
minio:
|
|
condition: service_started
|
|
networks:
|
|
- furniture-network
|
|
mem_limit: 1g
|
|
cpus: 2.0
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:3001/api/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
|
|
# PostgreSQL 数据库 - 轻量级配置
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
container_name: furniture-postgres
|
|
restart: unless-stopped
|
|
environment:
|
|
- POSTGRES_DB=furniture_db
|
|
- POSTGRES_USER=postgres
|
|
- POSTGRES_PASSWORD=${DB_PASSWORD}
|
|
- PGDATA=/var/lib/postgresql/data/pgdata
|
|
command: >
|
|
postgres
|
|
-c shared_buffers=128MB
|
|
-c max_connections=50
|
|
-c work_mem=8MB
|
|
-c maintenance_work_mem=64MB
|
|
-c effective_cache_size=256MB
|
|
-c checkpoint_completion_target=0.9
|
|
-c wal_buffers=8MB
|
|
-c default_statistics_target=50
|
|
-c random_page_cost=1.1
|
|
-c effective_io_concurrency=200
|
|
volumes:
|
|
- postgres-data:/var/lib/postgresql/data
|
|
networks:
|
|
- furniture-network
|
|
mem_limit: 512m
|
|
cpus: 1.0
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U postgres -d furniture_db"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# MinIO 对象存储 - 轻量级配置
|
|
minio:
|
|
image: minio/minio:latest
|
|
container_name: furniture-minio
|
|
restart: unless-stopped
|
|
environment:
|
|
- MINIO_ROOT_USER=${MINIO_USER}
|
|
- MINIO_ROOT_PASSWORD=${MINIO_PASSWORD}
|
|
- MINIO_BROWSER_REDIRECT_URL=http://localhost:9001
|
|
command: server /data --console-address ":9001"
|
|
volumes:
|
|
- minio-data:/data
|
|
networks:
|
|
- furniture-network
|
|
mem_limit: 512m
|
|
cpus: 0.5
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
|
|
interval: 30s
|
|
timeout: 20s
|
|
retries: 3
|
|
|
|
# Redis 缓存 - 轻量级配置
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: furniture-redis
|
|
restart: unless-stopped
|
|
command: >
|
|
redis-server
|
|
--maxmemory 200mb
|
|
--maxmemory-policy allkeys-lru
|
|
--save 900 1
|
|
--save 300 10
|
|
--appendonly no
|
|
volumes:
|
|
- redis-data:/data
|
|
networks:
|
|
- furniture-network
|
|
mem_limit: 256m
|
|
cpus: 0.5
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 3s
|
|
retries: 3
|
|
|
|
networks:
|
|
furniture-network:
|
|
driver: bridge
|
|
|
|
volumes:
|
|
postgres-data:
|
|
driver: local
|
|
minio-data:
|
|
driver: local
|
|
redis-data:
|
|
driver: local
|
|
nginx-cache:
|
|
driver: local
|