File size: 929 Bytes
d27f964
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Use a base image with Python
FROM python:3.9-slim

# Set the working directory in the container
WORKDIR /app

# Copy the requirements file and install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy the application files
COPY app_flask.py .
COPY app.py .
COPY best_random_forest_pipeline.joblib .

# Expose the port that your Flask app will run on (Gunicorn default is 8000)
EXPOSE 8000

# Expose the port that your Streamlit app will run on
EXPOSE 8501

# Command to run the application
# This command starts Gunicorn for the Flask app in the background
# and then starts the Streamlit app.
# Note: In a production environment, a process manager like supervisord
# is recommended for robust process management.
CMD ["sh", "-c", "gunicorn --bind 0.0.0.0:8000 app_flask:app & streamlit run app.py --server.port 8501 --server.enableCORS false --server.enableXsrfProtection false"]