Files
life-echo/api/docker-compose.yml

39 lines
766 B
YAML
Raw Normal View History

version: '3.8'
services:
api:
build:
context: .
dockerfile: Dockerfile
image: life-echo-api:latest
container_name: life-echo-api-prod
ports:
- "8000:8000"
env_file:
- .env.prod
volumes:
# 持久化数据库
- ./data:/app/data
restart: always
healthcheck:
test: ["CMD", "python", "-c", "import requests; requests.get('http://localhost:8000/health')"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
networks:
- life-echo-network
# 资源限制
deploy:
resources:
limits:
cpus: '2'
memory: 2G
reservations:
cpus: '1'
memory: 1G
networks:
life-echo-network:
driver: bridge