File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 1
- FROM python:3.12 as builder
2
-
3
- WORKDIR /app
1
+ FROM python:3.12 AS builder
4
2
3
+ WORKDIR /builder
5
4
# python
6
5
ENV PYTHONUNBUFFERED=1 \
7
6
# prevents python creating .pyc files
@@ -17,6 +16,10 @@ RUN pip wheel --no-cache-dir --no-deps --wheel-dir ./wheels -r requirements.txt
17
16
18
17
FROM python:3.12-slim AS app
19
18
19
+ RUN adduser --system --group --home /home/nonroot nonroot
20
+ ENV PATH="/home/nonroot/.local/bin:${PATH}"
21
+ USER nonroot:nonroot
22
+
20
23
WORKDIR /app
21
24
22
25
# python
@@ -28,11 +31,10 @@ ENV PYTHONUNBUFFERED=1 \
28
31
PIP_NO_CACHE_DIR=off \
29
32
PIP_DISABLE_PIP_VERSION_CHECK=on
30
33
31
- COPY --from=builder /app /wheels ./wheels
32
- COPY --from=builder /app /requirements.txt ./
34
+ COPY --from=builder /builder /wheels ./wheels
35
+ COPY --from=builder /builder /requirements.txt ./
33
36
34
37
RUN pip install --no-cache-dir ./wheels/*
35
- ENV PATH="/home/abc/.local/bin:${PATH}"
36
38
37
39
COPY ./src ./src
38
40
You can’t perform that action at this time.
0 commit comments