version: '3.8' services: db: image: postgres:18-alpine restart: always env_file: - .env volumes: - postgres_data:/var/lib/postgresql/data - ./postgres/init.sql:/docker-entrypoint-initdb.d/init.sql - ./postgres/custom-postgresql.conf:/etc/postgresql/postgresql.conf:ro - ./postgres/pg_hba.conf:/var/lib/postgresql/data/pg_hba.conf:ro command: postgres -c config_file=/etc/postgresql/postgresql.conf healthcheck: test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"] interval: 10s timeout: 5s retries: 5 ports: - "127.0.0.1:5432:5432" # Bound to localhost for security (as in old project) redis: image: redis:7-alpine restart: always ports: - "127.0.0.1:6379:6379" backend: build: context: ./backend dockerfile: Dockerfile restart: always env_file: - ./backend/.env volumes: - static_data:/app/staticfiles - media_data:/app/mediafiles expose: - "8000" depends_on: db: condition: service_healthy redis: condition: service_started celery: build: context: ./backend dockerfile: Dockerfile restart: always env_file: - ./backend/.env volumes: - media_data:/app/mediafiles command: celery -A core worker -l INFO depends_on: db: condition: service_healthy redis: condition: service_started backend: condition: service_started frontend: build: context: ./frontend dockerfile: Dockerfile restart: always env_file: - ./frontend/.env expose: - "80" nginx: image: nginx:alpine restart: always ports: - "80:80" # - "443:443" # Uncomment when adding SSL volumes: - ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf:ro - ./nginx/.htpasswd:/etc/nginx/.htpasswd:ro - static_data:/usr/share/nginx/html/staticfiles:ro - media_data:/usr/share/nginx/html/mediafiles:ro depends_on: - backend - frontend volumes: postgres_data: static_data: media_data: