File size: 931 Bytes
722f3e2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
27
28
29
# 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"]