first commit
This commit is contained in:
120
deploy/compose-without-build.yml
Normal file
120
deploy/compose-without-build.yml
Normal file
@@ -0,0 +1,120 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
# PostgreSQL数据库
|
||||
postgres:
|
||||
image: postgres:14-alpine
|
||||
container_name: algorithm-showcase-postgres
|
||||
environment:
|
||||
POSTGRES_DB: algorithm_db
|
||||
POSTGRES_USER: admin
|
||||
POSTGRES_PASSWORD: password
|
||||
ports:
|
||||
- "5432: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: redis:7-alpine
|
||||
container_name: algorithm-showcase-redis
|
||||
ports:
|
||||
- "6379:6379"
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
# MinIO对象存储 (S3兼容)
|
||||
minio:
|
||||
image: minio/minio:latest
|
||||
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:
|
||||
image: python:3.9-slim
|
||||
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:-your_openai_api_key_here}
|
||||
- SECRET_KEY=${SECRET_KEY:-your-secret-key-here}
|
||||
- ALGORITHM=HS256
|
||||
- ACCESS_TOKEN_EXPIRE_MINUTES=30
|
||||
volumes:
|
||||
- ../backend:/app
|
||||
working_dir: /app
|
||||
command: >
|
||||
sh -c "pip install --no-cache-dir -r requirements.txt &&
|
||||
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload"
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
|
||||
# 前端服务 (使用预构建镜像)
|
||||
frontend:
|
||||
image: node:18-alpine
|
||||
container_name: algorithm-showcase-frontend
|
||||
ports:
|
||||
- "3000:3000"
|
||||
depends_on:
|
||||
- backend
|
||||
volumes:
|
||||
- ../frontend:/app
|
||||
working_dir: /app
|
||||
command: >
|
||||
sh -c "npm install &&
|
||||
npm run dev -- --host 0.0.0.0 --port 3000"
|
||||
environment:
|
||||
- NODE_ENV=development
|
||||
- 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
|
||||
Reference in New Issue
Block a user