69 lines
1.5 KiB
YAML
Executable File
69 lines
1.5 KiB
YAML
Executable File
version: '3.8'
|
|
|
|
services:
|
|
api:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: gfmas-api-prod
|
|
ports:
|
|
- "8000:8000"
|
|
environment:
|
|
- PYTHONUNBUFFERED=1
|
|
- LOG_LEVEL=info
|
|
volumes:
|
|
- ./logs:/app/logs
|
|
restart: unless-stopped
|
|
logging:
|
|
driver: "json-file"
|
|
options:
|
|
max-size: "100m"
|
|
max-file: "3"
|
|
|
|
frontend:
|
|
image: nginx:alpine
|
|
container_name: gfmas-frontend-prod
|
|
ports:
|
|
- "80:80"
|
|
volumes:
|
|
- ./frontend/dist:/usr/share/nginx/html:ro
|
|
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
|
depends_on:
|
|
- api
|
|
restart: unless-stopped
|
|
|
|
# 可选:Prometheus监控
|
|
prometheus:
|
|
image: prom/prometheus:latest
|
|
container_name: gfmas-prometheus
|
|
ports:
|
|
- "9090:9090"
|
|
volumes:
|
|
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
|
|
- prometheus_data:/prometheus
|
|
command:
|
|
- '--config.file=/etc/prometheus/prometheus.yml'
|
|
- '--storage.tsdb.path=/prometheus'
|
|
restart: unless-stopped
|
|
profiles:
|
|
- monitoring
|
|
|
|
# 可选:Grafana可视化
|
|
grafana:
|
|
image: grafana/grafana:latest
|
|
container_name: gfmas-grafana
|
|
ports:
|
|
- "3001:3000"
|
|
volumes:
|
|
- grafana_data:/var/lib/grafana
|
|
- ./grafana/dashboards:/etc/grafana/provisioning/dashboards:ro
|
|
environment:
|
|
- GF_SECURITY_ADMIN_PASSWORD=${GF_SECURITY_ADMIN_PASSWORD:?Set GF_SECURITY_ADMIN_PASSWORD in .env}
|
|
restart: unless-stopped
|
|
profiles:
|
|
- monitoring
|
|
|
|
volumes:
|
|
prometheus_data:
|
|
grafana_data:
|