# Dockerfile for Resource Calculator Project # Optimized for FastAPI with robust network handling and health checks FROM python:3.11-slim # Build arguments for network timeout handling (as per reference) ARG PIP_DEFAULT_TIMEOUT=1000 ARG PIP_RETRIES=5 # Set environment variables ENV PIP_DEFAULT_TIMEOUT=${PIP_DEFAULT_TIMEOUT} ENV PIP_RETRIES=${PIP_RETRIES} ENV PYTHONUNBUFFERED=1 ENV PORT=8000 # Set working directory WORKDIR /app # Copy requirements file COPY requirements.txt . # Install Python dependencies in optimized batches (as per reference style) # Note: Removed OpenCV/YOLO dependencies as they are not needed for this project RUN pip install --no-cache-dir --timeout=1000 \ -r requirements.txt # Copy application files explicitly COPY . . # Create a non-privileged user for security RUN useradd -m -u 1000 user RUN chown -R user:user /app USER user # Expose port 8000 EXPOSE 7860 # Run the application CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]