59 lines
1.3 KiB
YAML
59 lines
1.3 KiB
YAML
|
|
version: '3.8'
|
|||
|
|
|
|||
|
|
services:
|
|||
|
|
tsp-assistant:
|
|||
|
|
build: .
|
|||
|
|
container_name: tsp_assistant
|
|||
|
|
ports:
|
|||
|
|
- "5000:5000"
|
|||
|
|
environment:
|
|||
|
|
- PYTHONPATH=/app
|
|||
|
|
- DATABASE_URL=sqlite:///tsp_assistant.db
|
|||
|
|
volumes:
|
|||
|
|
- ./data:/app/data
|
|||
|
|
- ./logs:/app/logs
|
|||
|
|
- ./backups:/app/backups
|
|||
|
|
- tsp_db:/app
|
|||
|
|
restart: unless-stopped
|
|||
|
|
healthcheck:
|
|||
|
|
test: ["CMD", "curl", "-f", "http://localhost:5000/api/health"]
|
|||
|
|
interval: 30s
|
|||
|
|
timeout: 10s
|
|||
|
|
retries: 3
|
|||
|
|
start_period: 40s
|
|||
|
|
|
|||
|
|
# MySQL数据库服务(可选)
|
|||
|
|
mysql:
|
|||
|
|
image: mysql:8.0
|
|||
|
|
container_name: tsp_mysql
|
|||
|
|
environment:
|
|||
|
|
MYSQL_ROOT_PASSWORD: root123456
|
|||
|
|
MYSQL_DATABASE: tsp_assistant
|
|||
|
|
MYSQL_USER: tsp_user
|
|||
|
|
MYSQL_PASSWORD: tsp_password
|
|||
|
|
ports:
|
|||
|
|
- "3306:3306"
|
|||
|
|
volumes:
|
|||
|
|
- mysql_data:/var/lib/mysql
|
|||
|
|
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
|
|||
|
|
restart: unless-stopped
|
|||
|
|
command: --default-authentication-plugin=mysql_native_password
|
|||
|
|
|
|||
|
|
# Nginx反向代理(可选)
|
|||
|
|
nginx:
|
|||
|
|
image: nginx:alpine
|
|||
|
|
container_name: tsp_nginx
|
|||
|
|
ports:
|
|||
|
|
- "80:80"
|
|||
|
|
- "443:443"
|
|||
|
|
volumes:
|
|||
|
|
- ./nginx.conf:/etc/nginx/nginx.conf
|
|||
|
|
- ./ssl:/etc/nginx/ssl
|
|||
|
|
depends_on:
|
|||
|
|
- tsp-assistant
|
|||
|
|
restart: unless-stopped
|
|||
|
|
|
|||
|
|
volumes:
|
|||
|
|
tsp_db:
|
|||
|
|
mysql_data:
|