54 lines
1.4 KiB
YAML
54 lines
1.4 KiB
YAML
services:
|
||
backend:
|
||
build: ./backend
|
||
container_name: cywl-scoring-backend
|
||
# 使用 gunicorn 替代 runserver,提高稳定性,并捕获标准输出
|
||
command: sh -c "python manage.py collectstatic --noinput && python manage.py migrate && gunicorn --bind 0.0.0.0:8876 --access-logfile - --error-logfile - config.wsgi:application"
|
||
volumes:
|
||
- ./backend:/app
|
||
- ./backend/media:/app/media
|
||
ports:
|
||
- "8876:8876"
|
||
environment:
|
||
- DB_NAME=sign-up
|
||
- DB_USER=sign-up
|
||
- DB_PASSWORD=123market
|
||
- DB_HOST=6.6.6.66
|
||
- DB_PORT=5432
|
||
networks:
|
||
- scoring_network
|
||
healthcheck:
|
||
test: ["CMD", "python", "-c", "import requests; requests.get('http://localhost:8876/api/health/')"]
|
||
interval: 30s
|
||
timeout: 10s
|
||
retries: 3
|
||
start_period: 40s
|
||
|
||
frontend:
|
||
build:
|
||
context: ./frontend
|
||
args:
|
||
- VITE_API_URL=/api
|
||
container_name: cywl-scoring-frontend
|
||
# volumes:
|
||
# - ./frontend:/app
|
||
# - /app/node_modules
|
||
ports:
|
||
- "8890:8890"
|
||
environment:
|
||
- VITE_API_URL=http://backend:8876/api
|
||
depends_on:
|
||
backend:
|
||
condition: service_healthy
|
||
networks:
|
||
- scoring_network
|
||
healthcheck:
|
||
test: ["CMD", "curl", "-f", "http://localhost:8890/health"]
|
||
interval: 30s
|
||
timeout: 10s
|
||
retries: 3
|
||
|
||
networks:
|
||
scoring_network:
|
||
driver: bridge
|