services: db: image: postgres:16-alpine environment: POSTGRES_DB: ${POSTGRES_DB:-ilo} POSTGRES_USER: ${POSTGRES_USER:-ilo} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-ilo} volumes: - postgres_data:/var/lib/postgresql/data ports: - "5432:5432" healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-ilo}"] interval: 5s timeout: 5s retries: 10 web: build: . command: > sh -c "python manage.py migrate --noinput && python manage.py runserver 0.0.0.0:8000" volumes: - .:/app ports: - "8000:8000" env_file: .env # .env's HTTP_PROXY/HTTPS_PROXY are intended only for image builds (npm install). # Override them empty at runtime so the web container reaches sms.ir, ZarinPal, # IDPay etc. directly instead of through that proxy. environment: HTTP_PROXY: "" HTTPS_PROXY: "" http_proxy: "" https_proxy: "" depends_on: db: condition: service_healthy frontend: build: context: ./frontend args: HTTP_PROXY: ${HTTP_PROXY:-} HTTPS_PROXY: ${HTTPS_PROXY:-} # Browser-side: NEXT_PUBLIC_API_URL is what the user's browser hits — must be host-reachable. # Server-side: INTERNAL_API_URL is what the Next.js server hits when SSR fetches data — uses the compose network. environment: NEXT_PUBLIC_API_URL: http://localhost:8000 INTERNAL_API_URL: http://web:8000 volumes: - ./frontend:/app - /app/node_modules - /app/.next ports: - "3000:3000" depends_on: - web volumes: postgres_data: