manage.py check booted a full Django interpreter every 30s (~1.5s CPU per run) and never verified the server was actually responding. Probe the HTTP endpoint directly instead and relax the interval.
74 lines
1.6 KiB
YAML
74 lines
1.6 KiB
YAML
services:
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
restart: unless-stopped
|
|
expose:
|
|
- "6379"
|
|
volumes:
|
|
- redis_data:/data
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
vite:
|
|
build:
|
|
context: ./
|
|
dockerfile: ./Dockerfiles/vite/Dockerfile
|
|
restart: "no"
|
|
entrypoint: sh -c "npm run build"
|
|
volumes:
|
|
- ./static:/app/static
|
|
- ./assets:/app/assets
|
|
- ./templates:/app/templates
|
|
- ./app:/app/app
|
|
- ./vite.config.js:/app/vite.config.js
|
|
- ./postcss.config.js:/app/postcss.config.js
|
|
- ./tailwind.config.js:/app/tailwind.config.js
|
|
|
|
django:
|
|
build: .
|
|
restart: unless-stopped
|
|
expose:
|
|
- "8000"
|
|
env_file:
|
|
- .env
|
|
volumes:
|
|
- .:/app
|
|
command: ./entrypoint.sh
|
|
depends_on:
|
|
redis:
|
|
condition: service_healthy
|
|
vite:
|
|
condition: service_completed_successfully
|
|
healthcheck:
|
|
test: ["CMD", "python3", "-c", "import http.client; c=http.client.HTTPConnection('localhost',8000,timeout=5); c.request('GET','/login/'); exit(0 if c.getresponse().status<400 else 1)"]
|
|
interval: 2m
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
|
|
nginx:
|
|
image: nginx:alpine
|
|
restart: unless-stopped
|
|
ports:
|
|
- "${NGINX_PORT:-8080}:80"
|
|
env_file:
|
|
- .env
|
|
depends_on:
|
|
django:
|
|
condition: service_healthy
|
|
volumes:
|
|
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
|
- ./staticfiles:/app/static:ro
|
|
healthcheck:
|
|
test: ["CMD", "nginx", "-t"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
volumes:
|
|
redis_data:
|