services:
  db:
    image: postgres:15-alpine
    environment:
      POSTGRES_DB: miccheck
      POSTGRES_USER: miccheck
      POSTGRES_PASSWORD: password
    ports:
      - "5432:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U miccheck"]
      interval: 5s
      timeout: 5s
      retries: 5

  api:
    build:
      context: .
      dockerfile: src/api/MicCheck.Api/Dockerfile
    ports:
      - "8080:8080"
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
      - ConnectionStrings__DefaultConnection=Host=db;Database=miccheck;Username=miccheck;Password=password
      - Jwt__SecretKey=change-this-secret-key-in-production-must-be-32-chars
      - Jwt__Issuer=MicCheck
      - Jwt__Audience=MicCheck
    depends_on:
      db:
        condition: service_healthy

volumes:
  postgres_data:
