# Local stack. For day-to-day development you usually only need the database: # docker compose up -d postgres # To run everything as it would be deployed: # docker compose --profile full up --build services: postgres: image: postgres:16-alpine container_name: stackflow-postgres environment: POSTGRES_DB: stackflow POSTGRES_USER: stackflow POSTGRES_PASSWORD: stackflow ports: # Override STACKFLOW_DB_PORT (see .env.example) if something already listens on 5432 locally. - "${STACKFLOW_DB_PORT:-5432}:5432" volumes: - postgres-data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U stackflow -d stackflow"] interval: 5s timeout: 3s retries: 10 api: profiles: ["full"] build: context: ./backend container_name: stackflow-api depends_on: postgres: condition: service_healthy environment: SPRING_PROFILES_ACTIVE: dev DB_URL: jdbc:postgresql://postgres:5432/stackflow DB_USERNAME: stackflow DB_PASSWORD: stackflow JWT_SECRET: local-compose-secret-change-me-0123456789abcdef CORS_ALLOWED_ORIGINS: http://localhost:4200,http://localhost:8081 ports: - "8080:8080" web: profiles: ["full"] build: context: ./frontend container_name: stackflow-web environment: # nginx forwards the SPA's same-origin /api calls to the API container. API_UPSTREAM: http://api:8080 depends_on: - api ports: - "8081:80" volumes: postgres-data: