generated from bisco/codex-bootstrap
91 lines
2.4 KiB
YAML
91 lines
2.4 KiB
YAML
services:
|
|
backend:
|
|
build:
|
|
context: ../..
|
|
dockerfile: infra/docker/backend/Dockerfile
|
|
image: azionelab-backend:local
|
|
environment:
|
|
DJANGO_SECRET_KEY: ${DJANGO_SECRET_KEY}
|
|
DJANGO_ALLOWED_HOSTS: ${DJANGO_ALLOWED_HOSTS}
|
|
DJANGO_CSRF_TRUSTED_ORIGINS: ${DJANGO_CSRF_TRUSTED_ORIGINS}
|
|
DJANGO_DEBUG: ${DJANGO_DEBUG:-false}
|
|
CORS_ALLOWED_ORIGINS: ${CORS_ALLOWED_ORIGINS}
|
|
SITE_BASE_URL: ${SITE_BASE_URL}
|
|
TIME_ZONE: ${TIME_ZONE:-Europe/Rome}
|
|
DATABASE_URL: ${DATABASE_URL}
|
|
POSTGRES_DB: ${POSTGRES_DB}
|
|
POSTGRES_USER: ${POSTGRES_USER}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
|
POSTGRES_HOST: ${POSTGRES_HOST:-postgres}
|
|
POSTGRES_PORT: ${POSTGRES_PORT:-5432}
|
|
expose:
|
|
- "${BACKEND_PORT:-8000}"
|
|
volumes:
|
|
- django_static:/app/staticfiles
|
|
- django_media:/app/media
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
networks:
|
|
- internal
|
|
user: "0:0"
|
|
restart: unless-stopped
|
|
|
|
frontend:
|
|
build:
|
|
context: ../..
|
|
dockerfile: infra/docker/frontend/Dockerfile
|
|
image: azionelab-frontend:local
|
|
expose:
|
|
- "${FRONTEND_PORT:-8080}"
|
|
networks:
|
|
- internal
|
|
restart: unless-stopped
|
|
|
|
postgres:
|
|
image: postgres:16.3-alpine
|
|
environment:
|
|
POSTGRES_DB: ${POSTGRES_DB}
|
|
POSTGRES_USER: ${POSTGRES_USER}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U \"$${POSTGRES_USER}\" -d \"$${POSTGRES_DB}\""]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- internal
|
|
restart: unless-stopped
|
|
|
|
nginx:
|
|
image: nginx:1.27.0-alpine
|
|
ports:
|
|
- "${NGINX_HTTP_PORT:-8080}:80"
|
|
environment:
|
|
BACKEND_HOST: ${BACKEND_HOST:-backend}
|
|
BACKEND_PORT: ${BACKEND_PORT:-8000}
|
|
FRONTEND_HOST: ${FRONTEND_HOST:-frontend}
|
|
FRONTEND_PORT: ${FRONTEND_PORT:-8080}
|
|
NGINX_ENVSUBST_FILTER: "^(BACKEND_HOST|BACKEND_PORT|FRONTEND_HOST|FRONTEND_PORT)$"
|
|
volumes:
|
|
- ./nginx/templates:/etc/nginx/templates:ro
|
|
- django_static:/var/www/static:ro
|
|
- django_media:/var/www/media:ro
|
|
depends_on:
|
|
- backend
|
|
- frontend
|
|
networks:
|
|
- internal
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
postgres_data:
|
|
django_static:
|
|
django_media:
|
|
|
|
networks:
|
|
internal:
|
|
driver: bridge
|