94 lines
2.3 KiB
YAML
94 lines
2.3 KiB
YAML
services:
|
|
# ==================== PostgreSQL ====================
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
container_name: qingye-postgres
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_DB: qingye
|
|
POSTGRES_USER: qingye
|
|
POSTGRES_PASSWORD: qingye_secret
|
|
volumes:
|
|
- pgdata:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U qingye"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- qingye-network
|
|
|
|
# ==================== Redis ====================
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: qingye-redis
|
|
restart: unless-stopped
|
|
command: redis-server --appendonly yes
|
|
volumes:
|
|
- redisdata:/data
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- qingye-network
|
|
|
|
# ==================== Backend (FastAPI) ====================
|
|
backend:
|
|
build:
|
|
context: ./backend
|
|
dockerfile: Dockerfile
|
|
container_name: qingye-backend
|
|
restart: unless-stopped
|
|
ports:
|
|
- "8000:8000"
|
|
environment:
|
|
DATABASE_URL: postgresql+asyncpg://qingye:qingye_secret@postgres:5432/qingye
|
|
REDIS_URL: redis://redis:6379/0
|
|
JWT_SECRET_KEY: qingye-jwt-secret-change-in-production
|
|
JWT_REFRESH_SECRET_KEY: qingye-refresh-secret-change-in-production
|
|
CORS_ORIGINS: http://localhost:5173
|
|
ADMIN_PASSWORD: admin123
|
|
volumes:
|
|
- ./backend:/app
|
|
- upload_data:/app/uploads
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
networks:
|
|
- qingye-network
|
|
|
|
# ==================== Frontend (Vue 3 + Vite) ====================
|
|
frontend:
|
|
build:
|
|
context: ./frontend
|
|
dockerfile: Dockerfile
|
|
container_name: qingye-frontend
|
|
restart: unless-stopped
|
|
ports:
|
|
- "5173:5173"
|
|
environment:
|
|
VITE_API_BASE_URL: http://localhost:8000
|
|
VITE_WS_BASE_URL: ws://localhost:8000
|
|
volumes:
|
|
- ./frontend:/app
|
|
- /app/node_modules
|
|
depends_on:
|
|
- backend
|
|
networks:
|
|
- qingye-network
|
|
|
|
# ==================== Volumes ====================
|
|
volumes:
|
|
pgdata:
|
|
redisdata:
|
|
upload_data:
|
|
|
|
# ==================== Network ====================
|
|
networks:
|
|
qingye-network:
|
|
driver: bridge
|