version: "3.8"

services:
  db:
    image: postgres:15
    restart: always
    ports:
      - "6000:5432"
    environment:
      POSTGRES_USER: postgres123
      POSTGRES_PASSWORD: postgres123
      POSTGRES_DB: db_radar
    volumes:
      - postgres-data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres123"]
      interval: 5s
      timeout: 3s
      retries: 5

  api:
    build: .
    ports:
      - "3200:3200"
    env_file:
      - .env
    depends_on:
      db:
        condition: service_healthy

volumes:
  postgres-data:
