* feat: 添加 Docker 支持,包括后端和前端 Dockerfile、docker-compose 配置及 Nginx 配置 * feat: 添加 .dockerignore 文件,更新 Dockerfile 和 docker-compose 配置以支持数据持久化保存
41 lines
899 B
YAML
41 lines
899 B
YAML
version: '3.8'
|
|
|
|
services:
|
|
# 后端服务
|
|
backend:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile.backend
|
|
container_name: cultivation-backend
|
|
ports:
|
|
- "8002:8002"
|
|
environment:
|
|
- PYTHONUNBUFFERED=1
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8002/api/state"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 30s
|
|
volumes:
|
|
- ./assets/saves:/app/assets/saves
|
|
- ./logs:/app/logs
|
|
# 前端服务
|
|
frontend:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile.frontend
|
|
container_name: cultivation-frontend
|
|
ports:
|
|
- "8123:80"
|
|
depends_on:
|
|
- backend
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:80/"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|