MalikSahib1's picture
Update Dockerfile
ced8ba6 verified
# Use an official lightweight Python image as a parent image
FROM python:3.9-slim
# Set the working directory in the container to /code
WORKDIR /code
# Set the environment variable for the Hugging Face cache.
ENV HF_HOME /code/cache
ENV HUGGINGFACE_HUB_CACHE /code/cache
# --- THIS IS THE FINAL FIX ---
# Create the cache directory during the build and give it open permissions.
# The non-root user running the app needs permission to write to this folder.
RUN mkdir -p /code/cache && chmod 777 /code/cache
# Copy the requirements file into the container at /code
COPY ./requirements.txt /code/requirements.txt
# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
# Copy the rest of the application's code into the container at /code
COPY ./app.py /code/app.py
# Make port 7860 available to the world outside this container
EXPOSE 7860
# Command to run the application using uvicorn web server
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]