version: "3.9"
services:
  postgres:
    image: postgres:16
    restart: unless-stopped
    environment:
      POSTGRES_USER: parcel
      POSTGRES_PASSWORD: parcel
      POSTGRES_DB: parceldb
    ports:
      - "5432:5432"
    volumes:
      - pgdata:/var/lib/postgresql/data

  api:
    build:
      context: .
      dockerfile: apps/api/Dockerfile
    environment:
      PORT: 4000
      DATABASE_URL: postgres://parcel:parcel@postgres:5432/parceldb
    ports:
      - "4000:4000"
    depends_on:
      - postgres

volumes:
  pgdata:
