102 lines
2.4 KiB
YAML
102 lines
2.4 KiB
YAML
services:
|
|
# DB POSTGRESQL
|
|
db:
|
|
image: postgres:17
|
|
container_name: eiro-postgres
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_DB: ${DB_NAME}
|
|
POSTGRES_USER: ${DB_USER}
|
|
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
|
POSTGRES_INITDB_ARGS: "--locale=fr_FR.UTF-8"
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
# - ./backend/init-db.sql:/docker-entrypoint-initdb.d/init.sql:ro
|
|
ports:
|
|
- "5432:5432"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 20
|
|
|
|
# REDIS
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: eiro-redis
|
|
restart: unless-stopped
|
|
volumes:
|
|
- redis_data:/data
|
|
ports:
|
|
- "6379:6379"
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 20
|
|
|
|
# BACKEND DJANGO
|
|
backend:
|
|
build:
|
|
context: ./backend
|
|
dockerfile: ../backend.Dockerfile
|
|
container_name: eiro-backend
|
|
restart: unless-stopped
|
|
env_file: .env
|
|
volumes:
|
|
- ./backend:/app
|
|
- staticfiles:/app/staticfiles
|
|
- media:/app/media
|
|
expose:
|
|
- "8000"
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8000/api/v1/health/"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
command: >
|
|
sh -c "
|
|
ls -al /app &&
|
|
python manage.py migrate &&
|
|
python manage.py collectstatic --noinput &&
|
|
python manage.py runserver 0.0.0.0:8000
|
|
"
|
|
|
|
|
|
# NGINX
|
|
nginx:
|
|
image: nginx:1.25-alpine
|
|
build:
|
|
dockerfile: nginx.Dockerfile
|
|
container_name: eiro-nginx
|
|
restart: unless-stopped
|
|
volumes:
|
|
- ./frontend/deploy/nginx/nginx.conf:/etc/nginx/nginx.conf
|
|
- ./frontend/deploy/nginx/nginx-default.conf:/etc/nginx/conf.d/default.conf
|
|
- staticfiles:/var/www/html/static:ro
|
|
- media:/var/www/html/media:ro
|
|
# - ./certbot/conf:/etc/letsencrypt:ro
|
|
# - ./certbot/www:/var/www/certbot:ro
|
|
ports:
|
|
- "8000:80"
|
|
# - "443:443"
|
|
depends_on:
|
|
- backend
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:3000/"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
|
|
volumes:
|
|
postgres_data:
|
|
redis_data:
|
|
staticfiles:
|
|
media: |