services:
  openarchival.blazor:
    image: openarchivalblazor
    build:
      context: .
      dockerfile: OpenArchival.Blazor/Dockerfile
    environment:
        - ConnectionStrings__DefaultConnection=Host=db;Port=5432;Database=postgres;Username=postgres;Password=postgres
    depends_on: 
        db:
            condition: service_healthy
    ports:
        - 3801:8080
        - 4334:8081
  db:
    image: postgres:latest
    restart: always
    environment:
        - POSTGRES_USER=postgres
        - POSTGRES_PASSWORD=postgres
        - POSTGRES_DB=postgres
    ports: 
        - 5432:5432
    volumes:
        - postgres_data:/var/lib/postgresql
    healthcheck:
        test: ["CMD-SHELL", "pg_isready -U postgres -d postgres"]
        interval: 10s
        timeout: 5s
        retries: 5
        
volumes:
  postgres_data:

