hbcp / Dockerfile
omm7's picture
Upload folder using huggingface_hub
722f3e2 verified
raw
history blame contribute delete
931 Bytes
# Use a Python base image with a stable version
FROM python:3.9
# Set the working directory inside the container
WORKDIR /app
# Copy dependency files first for better Docker caching
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy the application logic and the serialized model file
COPY app.py .
# Ensure this file name matches the joblib dump file name
COPY hotel_cancellation_prediction_model_v1_0.joblib .
# Recommended security practice
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
COPY --chown=user . $HOME/app
# Define the command to run the Streamlit app on port "7860"
# and explicitly disable XSRF protection (critical for Hugging Face Spaces file uploads)
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false"]