# Use an official Python runtime as a parent image | |
FROM python:3.9-slim | |
# Set the working directory in the container | |
WORKDIR /app | |
# Create a writable cache directory | |
RUN mkdir -p /app/hf_cache && chmod -R 777 /app/hf_cache | |
# Set the environment variable to point to the new cache directory using HF_HOME | |
ENV HF_HOME=/app/hf_cache | |
# Copy the current directory contents into the container | |
COPY . /app | |
# Install any dependencies | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Expose port 5000 | |
EXPOSE 5000 | |
# Command to run the application | |
CMD ["python", "app.py"] | |