115 lines
2.9 KiB
YAML
115 lines
2.9 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
# PostgreSQL数据库
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
container_name: algorithm-showcase-postgres
|
|
environment:
|
|
POSTGRES_DB: algorithm_db
|
|
POSTGRES_USER: admin
|
|
POSTGRES_PASSWORD: password
|
|
ports:
|
|
- "5433:5432"
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U admin -d algorithm_db"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# Redis缓存
|
|
redis:
|
|
image: crpi-x2l5uviq1k8hji3c.ap-northeast-1.personal.cr.aliyuncs.com/yipaidocker-images/linux_amd64_redis:latest
|
|
platform: linux/amd64
|
|
container_name: algorithm-showcase-redis
|
|
ports:
|
|
- "6381:6379"
|
|
volumes:
|
|
- redis_data:/data
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# MinIO对象存储 (S3兼容)
|
|
minio:
|
|
image: crpi-x2l5uviq1k8hji3c.ap-northeast-1.personal.cr.aliyuncs.com/yipaidocker-images/linux_amd64_minio:latest
|
|
platform: linux/amd64
|
|
container_name: algorithm-showcase-minio
|
|
ports:
|
|
- "9000:9000"
|
|
- "9001:9001"
|
|
environment:
|
|
MINIO_ROOT_USER: minioadmin
|
|
MINIO_ROOT_PASSWORD: minioadmin
|
|
volumes:
|
|
- minio_data:/data
|
|
command: server /data --console-address ":9001"
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
|
|
interval: 30s
|
|
timeout: 20s
|
|
retries: 3
|
|
|
|
# 后端API服务
|
|
backend:
|
|
build:
|
|
context: ../backend
|
|
dockerfile: Dockerfile.custom
|
|
container_name: algorithm-showcase-backend
|
|
ports:
|
|
- "8000:8000"
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
minio:
|
|
condition: service_started
|
|
environment:
|
|
- DATABASE_URL=postgresql://admin:password@postgres:5432/algorithm_db
|
|
- REDIS_URL=redis://redis:6379/0
|
|
- MINIO_ENDPOINT=minio:9000
|
|
- MINIO_ACCESS_KEY=minioadmin
|
|
- MINIO_SECRET_KEY=minioadmin
|
|
- MINIO_BUCKET_NAME=algorithm-data
|
|
- MINIO_SECURE=false
|
|
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
|
- SECRET_KEY=${SECRET_KEY:-your-secret-key-here}
|
|
- ALGORITHM=HS256
|
|
- ACCESS_TOKEN_EXPIRE_MINUTES=30
|
|
volumes:
|
|
- ../backend:/app
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
# 前端服务
|
|
frontend:
|
|
build:
|
|
context: ../frontend
|
|
dockerfile: Dockerfile.prod.simple
|
|
container_name: algorithm-showcase-frontend
|
|
ports:
|
|
- "3000:80"
|
|
depends_on:
|
|
- backend
|
|
environment:
|
|
- VITE_API_BASE_URL=http://localhost:8000/api
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
postgres_data:
|
|
redis_data:
|
|
minio_data:
|
|
|
|
networks:
|
|
default:
|
|
driver: bridge
|
|
name: algorithm-showcase-network |