-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
28 lines (21 loc) · 732 Bytes
/
Dockerfile
File metadata and controls
28 lines (21 loc) · 732 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
# Dockerfile
# Stage 1: Build environment with dependencies
FROM python:3.9-slim AS builder
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt
# Stage 2: Production runtime with minimal footprint
FROM python:3.9-slim AS production
WORKDIR /app
# Copy Python dependencies from builder stage
COPY --from=builder /root/.local /root/.local
# Copy application code, models, etc.
COPY ./src ./src
COPY model.joblib .
# Set Python path and environment variables to find packages and modules
ENV PATH=/root/.local/bin:$PATH
ENV PYTHONPATH=/app/src
# Expose the port the app runs on
EXPOSE 8000
# Start the application
CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "8000"]