-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (29 loc) · 857 Bytes
/
Copy pathDockerfile
File metadata and controls
39 lines (29 loc) · 857 Bytes
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
30
31
32
33
34
35
36
37
38
39
# Use Python 3.11 slim image
FROM python:3.11-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
gcc \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements.txt first for caching
COPY requirements.txt .
# Upgrade pip and install dependencies
RUN pip install --upgrade pip setuptools wheel
# Install pandas and Flask explicitly to avoid source build issues
RUN pip install pandas==2.1.4 Flask==3.0.0
RUN pip install -r requirements.txt
# Copy the rest of the project
COPY . .
# Train the model during build
RUN python model_trainer.py
# Expose Flask port
EXPOSE 5000
# Default command: do nothing (use Makefile to run app)
CMD ["tail", "-f", "/dev/null"]