# Step 1: Use an official Python runtime as a parent image FROM python:3.9-slim # Step 2: Set the working directory WORKDIR /app # Step 3: Copy the requirements file into the container COPY requirements.txt /app/ # Step 4: Install any dependencies RUN pip install --no-cache-dir -r requirements.txt # Set an environment variable for Hugging Face cache ENV TRANSFORMERS_CACHE=/app/huggingface_cache # Ensure the cache directory is writable RUN mkdir -p /app/huggingface_cache && chmod -R 777 /app/huggingface_cache # Step 5: Copy the rest of the application code COPY . /app/ # # Step 6: Expose the port that FastAPI will run on # EXPOSE 8000 # Step 7: Command to run the FastAPI app using Uvicorn CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]