services:
  postgres:
    image: postgres:16
    environment:
      POSTGRES_USER: companytool
      POSTGRES_PASSWORD: companytool
      POSTGRES_DB: companytool
    ports:
      - "5432:5432"
    volumes:
      - companytool-postgres:/var/lib/postgresql/data

  backend:
    build:
      context: .
      dockerfile: backend/Dockerfile
    profiles:
      - backend
    depends_on:
      - postgres
    environment:
      DATABASE_URL: postgres://companytool:companytool@postgres:5432/companytool
      BACKEND_BIND: 0.0.0.0:8080
      COMPANYTOOL_EMAIL_TRANSPORT: outbox
      COMPANYTOOL_DOCUMENT_STORAGE_DIR: /var/lib/companytool/documents
    ports:
      - "8080:8080"
    volumes:
      - companytool-documents:/var/lib/companytool/documents

volumes:
  companytool-postgres:
  companytool-documents:
