agenda_culturel/docker-compose.prod.yml
2023-11-15 16:00:08 +01:00

88 lines
2.2 KiB
YAML

version: '3.7'
services:
backend:
container_name: "${APP_NAME}-backend"
build:
context: .
dockerfile: deployment/Dockerfile
args:
- APP_NAME=${APP_NAME}
- APP_HOST=${APP_HOST}
- APP_PORT=${APP_PORT}
volumes:
- ./src:/usr/src/app/
- ./deployment/scripts:/app/deployment/scripts/
- static_files:/usr/src/app/static
- media_files:/usr/src/app/media
env_file: .env.prod
expose:
- "${APP_PORT:-8000}"
depends_on:
- db
command: [ "/bin/bash", "/app/deployment/scripts/wait-db.sh", "/app/deployment/scripts/backend/start.sh" ]
db:
image: postgres:15.2-alpine
container_name: "${APP_NAME}-db"
hostname: "${POSTGRES_HOST:-db}"
volumes:
- postgres_data_dir:/var/lib/postgresql/data/
env_file: .env.prod
expose:
- "${POSTGRES_PORT:-5432}"
shm_size: 1g
healthcheck:
test: ["CMD", "pg_isready", "-U", "${POSTGRES_USER}", "-d", "${POSTGRES_DB}"]
interval: 10s
timeout: 5s
retries: 5
redis:
container_name: "${APP_NAME}-redis"
image: redis:latest
volumes:
- redis_data:/data
celery-worker: &celery-worker
container_name: "${APP_NAME}-celery-worker"
build:
context: .
dockerfile: deployment/Dockerfile
volumes:
- ./src:/usr/src/app/
- ./deployment/scripts:/app/deployment/scripts/
- static_files:/usr/src/app/static
- media_files:/usr/src/app/media
env_file: .env.prod
depends_on:
- db
- redis
- backend
command: [ "/bin/bash", "/app/deployment/scripts/wait-db.sh", "/app/deployment/scripts/celery/start-worker.sh" ]
celery-beat:
<<: *celery-worker
container_name: "${APP_NAME}-celery-beat"
command: [ "/bin/bash", "/app/deployment/scripts/wait-db.sh", "/app/deployment/scripts/celery/start-beat.sh" ]
nginx:
image: nginx:latest
container_name: "${APP_NAME}-nginx"
volumes:
- ./deployment/scripts/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- static_files:/usr/src/app/static
- media_files:/usr/src/app/media
env_file: .env.prod
ports:
- 6380:80
depends_on:
- backend
volumes:
static_files:
media_files:
postgres_data_dir:
redis_data: