services:
  postgres:
    image: postgres:16
    container_name: freman.sample.postgres
    environment:
      POSTGRES_DB: freman_sample
      POSTGRES_USER: appuser
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-CHANGE_ME}
    ports:
      - "5432:5432"
    volumes:
      - freman_sample_pgdata:/var/lib/postgresql/data
    healthcheck:
      test: [ "CMD-SHELL", "pg_isready -U appuser -d freman_sample" ]
      interval: 5s
      timeout: 3s
      retries: 20
      
  freman.sample.web:
    image: freman.sample.web
    build:
      context: .
      dockerfile: Freman.Sample.Web/Freman.Sample.Web/Dockerfile
    depends_on:
      postgres:
        condition: service_healthy
    environment:
      ASPNETCORE_ENVIRONMENT: Development
      ConnectionStrings__AppDb: Host=postgres;Port=5432;Database=freman_sample;Username=appuser;Password=${POSTGRES_PASSWORD:-CHANGE_ME}


  freman.sample.web.client:
    image: freman.sample.web.client
    build:
      context: .
      dockerfile: Freman.Sample.Web/Freman.Sample.Web.Client/Dockerfile

volumes:
  freman_sample_pgdata: