File size: 792 Bytes
a88873a
0fa6542
a88873a
e2781d2
0fa6542
e2781d2
 
 
0fa6542
e2781d2
a88873a
e2781d2
a88873a
0fa6542
e2781d2
 
 
 
 
 
a88873a
0fa6542
e2781d2
a88873a
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
FROM python:3.10-slim

# Install system dependencies
RUN apt-get update && apt-get install -y build-essential && rm -rf /var/lib/apt/lists/*

# Copy requirements and install Python dependencies
COPY requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r /app/requirements.txt

# Copy training script and application code
WORKDIR /app
COPY train_model.py /app/train_model.py
COPY app.py /app/app.py

# ------------------------------------------------------------
# Train the model during the Docker build phase (creates model.pkl)
# ------------------------------------------------------------
RUN python train_model.py

# Expose Streamlit port
EXPOSE 7860

# Start the Streamlit app
CMD ["streamlit", "run", "app.py", "--server.port", "7860", "--server.address", "0.0.0.0"]