services:
  db:
    image: postgres:16
    restart: always
    environment:
      POSTGRES_DB: zorbs
      POSTGRES_USER: zorbs
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
    volumes:
      - postgres_data:/var/lib/postgresql/data
    ports:
      - "5432:5432"

  zorbs:
    build: .
    restart: always
    ports:
      - "3000:3000"
    env_file:
      - .env
    environment:
      # Override DATABASE_URL inside Docker so it connects to the db container
      DATABASE_URL: postgres://zorbs:${POSTGRES_PASSWORD}@db:5432/zorbs
    volumes:
      - ./uploads:/uploads
    depends_on:
      - db

volumes:
  postgres_data:
