services:
  app:
    build: .
    container_name: fpmb
    restart: unless-stopped
    ports:
      - "8080:8080"
    environment:
      - PORT=8080
      - MONGO_URI=mongodb://mongo:27017
      - MONGO_DB_NAME=fpmb
      - JWT_SECRET=${JWT_SECRET:-changeme-jwt-secret}
      - JWT_REFRESH_SECRET=${JWT_REFRESH_SECRET:-changeme-refresh-secret}
    volumes:
      - app_data:/app/data
    depends_on:
      mongo:
        condition: service_healthy

  mongo:
    image: mongo:7
    container_name: fpmb-mongo
    restart: unless-stopped
    ports:
      - "27017:27017"
    volumes:
      - mongo_data:/data/db
    healthcheck:
      test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
      interval: 10s
      timeout: 5s
      retries: 5
      start_period: 10s

volumes:
  app_data:
  mongo_data:
