File size: 556 Bytes
b309781 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # Use a lightweight Python image
FROM python:3.9-slim
# Create a non-root user for security (required by Hugging Face)
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:${PATH}"
# Set the working directory
WORKDIR /app
# Copy requirements first to leverage Docker cache
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of your files (app.py and model.joblib)
COPY --chown=user . .
# Expose the port Hugging Face expects
EXPOSE 7860
# Start the script
CMD ["python", "app.py"] |