We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 622a5a3 commit a4854b2Copy full SHA for a4854b2
Dockerfile
@@ -1,13 +1,29 @@
1
-FROM python:3.12-slim
+# ======================
2
+# Stage 1: Test stage
3
4
+FROM python:3.12-slim AS test
5
6
WORKDIR /app
7
8
COPY requirements.txt .
-RUN pip install --no-cache-dir -r requirements.txt
9
+RUN pip install --no-cache-dir -r requirements.txt pytest
10
11
COPY . .
12
-# 👇 THIS IS THE IMPORTANT FIX
-ENV PYTHONPATH=/app
-
13
CMD ["pytest"]
14
+
15
16
17
+# Stage 2: Production stage
18
19
+FROM python:3.12-slim AS production
20
21
+WORKDIR /app
22
23
+COPY requirements.txt .
24
+RUN pip install --no-cache-dir -r requirements.txt
25
26
+COPY app ./app
27
+COPY app.py .
28
29
+CMD ["python", "app.py"]
0 commit comments