services: postgres: image: postgres:16-alpine container_name: identity-postgres environment: POSTGRES_DB: ${POSTGRES_DB:-identity} POSTGRES_USER: ${POSTGRES_USER:-identity} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-identity} volumes: - postgres_data:/var/lib/postgresql/data ports: - "${POSTGRES_PORT:-5432}:5432" healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-identity} -d ${POSTGRES_DB:-identity}"] interval: 5s timeout: 5s retries: 10 redis: image: redis:7-alpine container_name: identity-redis command: redis-server --appendonly yes volumes: - redis_data:/data ports: - "${REDIS_PORT:-6379}:6379" healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 5s timeout: 5s retries: 10 api: build: context: . dockerfile: docker/Dockerfile.api container_name: identity-api command: > sh -c "python manage.py migrate --noinput && gunicorn config.wsgi:application --bind 0.0.0.0:8000 --workers 3" environment: DJANGO_ENV: ${DJANGO_ENV:-development} DJANGO_DEBUG: ${DJANGO_DEBUG:-true} DJANGO_SECRET_KEY: ${DJANGO_SECRET_KEY:-dev-only-insecure-secret-key} DJANGO_ALLOWED_HOSTS: ${DJANGO_ALLOWED_HOSTS:-localhost,127.0.0.1,0.0.0.0,backend,frontend} DATABASE_URL: ${DATABASE_URL:-postgres://identity:identity@postgres:5432/identity} REDIS_URL: ${REDIS_URL:-redis://redis:6379/0} CORS_ALLOWED_ORIGINS: ${CORS_ALLOWED_ORIGINS:-http://localhost:3000} CSRF_TRUSTED_ORIGINS: ${CSRF_TRUSTED_ORIGINS:-http://localhost:3000} volumes: - ./apps/api:/app ports: - "8000:8000" depends_on: postgres: condition: service_healthy redis: condition: service_healthy web: build: context: . dockerfile: docker/Dockerfile.web container_name: identity-web environment: NEXT_PUBLIC_SITE_NAME: ${NEXT_PUBLIC_SITE_NAME:-Identity Platform} NEXT_PUBLIC_SITE_URL: ${NEXT_PUBLIC_SITE_URL:-http://localhost:3000} NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL:-http://localhost:8000/api/v1} ports: - "3000:3000" depends_on: - api volumes: postgres_data: redis_data: