Skip to content

Commit a61ee51

Browse files
Updated Dockerfile
1 parent e825215 commit a61ee51

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

Dockerfile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
FROM python:3.11-slim
1+
# ---------- Stage 1: Build dependencies ----------
2+
FROM python:3.11-slim AS builder
23

34
WORKDIR /app
45

5-
# Install minimal system dependencies
66
RUN apt-get update && apt-get install -y --no-install-recommends \
77
build-essential \
88
libopenblas-dev \
@@ -13,8 +13,18 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1313
COPY req.txt .
1414

1515
RUN pip install --upgrade pip \
16-
&& pip install --no-cache-dir -r req.txt
16+
&& pip install --no-cache-dir -r req.txt \
17+
&& pip install --no-cache-dir uvicorn
18+
19+
# ---------- Stage 2: Final lightweight image ----------
20+
FROM python:3.11-slim
21+
22+
WORKDIR /app
23+
24+
# Copy only installed packages (fast!)
25+
COPY --from=builder /usr/local /usr/local
1726

27+
# Copy app code
1828
COPY . .
1929

2030
EXPOSE 8000

0 commit comments

Comments
 (0)