version: '3.8'

services:
  pdf-processor:
    build: 
      context: .
      dockerfile: Dockerfile
    container_name: pdf-processor
    restart: always
    ports:
      - "3000:3000"
    env_file:
      - .env
    volumes:
      - ./docker-volumes/logs:/app/logs
      - /tmp:/tmp  # For temporary PDF processing
    networks:
      - pdf-network
    healthcheck:
      test: ["CMD", "node", "src/healthcheck.js"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s
    deploy:
      resources:
        limits:
          memory: 2G
          cpus: '1.0'
        reservations:
          memory: 512M
          cpus: '0.25'
    environment:
      - NODE_ENV=production
      - LOG_LEVEL=info
      - MAX_FILE_SIZE=100MB
      - PROCESSING_TIMEOUT=300000  # 5 minutes

volumes:
  logs:
    driver: local

networks:
  pdf-network:
    driver: bridge