Spaces:
Sleeping
Sleeping
File size: 795 Bytes
6b9715a cb2502d 7df9b02 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
FROM python:3.9
# Create a user with UID 1000 and set as default user
RUN useradd -m -u 1000 user
USER user
# Set environment variables for the user
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /app
# Set HF_HOME environment variable to a writable directory
# This tells huggingface_hub where to store its cache and downloaded models
ENV HF_HOME="/app/.cache/huggingface"
# Copy requirements.txt first to leverage Docker cache
COPY --chown=user ./requirements.txt requirements.txt
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Copy the rest of your application code
COPY --chown=user . /app
# Command to run your Flask application
# It will listen on the PORT environment variable provided by Hugging Face Spaces
CMD ["python", "app.py"] |