# Use the official Python 3.10.9 image FROM python:3.10.9 # Install wkhtmltopdf and its dependencies RUN apt-get update && apt-get install -y \ wkhtmltopdf \ && rm -rf /var/lib/apt/lists/* # Set the working directory WORKDIR /app # Create a temporary folder with write permissions RUN mkdir /app/temp && chmod 777 /app/temp COPY requirements.txt . # Install requirements RUN pip install --no-cache-dir --upgrade -r requirements.txt # Copy the current directory contents into the container COPY . . # Ensure the correct permissions for hrequests library path RUN chmod -R a+w /usr/local/lib/python3.10/site-packages/hrequests/bin/ # Start the FastAPI app on port 7860, the default port expected by Spaces CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]