version: '3.8'

services:
  app:
    build:
      context: .
      dockerfile: Dockerfile.dev
    ports:
      - "8090:8090"
    volumes:
      - ./:/app
      - go-build-cache:/root/.cache/go-build
      - go-mod-cache:/go/pkg/mod
    environment:
      - GOFLAGS=-mod=mod
    command: air -c .air.toml

  app-prod:
    build:
      context: .
      dockerfile: Dockerfile.prod
    ports:
      - "8091:8090"
    volumes:
      - ./pb_data_prod:/app/pb_data
    environment:
      - ENVIRONMENT=production
    profiles:
      - prod

volumes:
  go-build-cache:
  go-mod-cache:
