File tree Expand file tree Collapse file tree 3 files changed +21
-3
lines changed
Expand file tree Collapse file tree 3 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,8 @@ ENTRYPOINT ["/app/entrypoint.sh"]
1414
1515FROM base AS builder
1616
17- RUN pip install poetry
17+ RUN --mount=type=cache,target=/root/.cache/pip \
18+ pip install poetry
1819
1920COPY ./pyproject.toml ./poetry.lock ./
2021RUN --mount=type=cache,target=/root/.cache/pypoetry \
@@ -34,6 +35,11 @@ COPY --from=builder /app/.venv/ /app/.venv/
3435COPY ./syncmaster/ /app/syncmaster/
3536RUN python -m compileall -b syncmaster
3637
38+ # Do not run production as root, to improve security.
39+ # Also user does not own anything inside the image, including venv and source code.
40+ RUN useradd syncmaster
41+ USER syncmaster
42+
3743
3844FROM builder AS test
3945
Original file line number Diff line number Diff line change @@ -36,7 +36,8 @@ ENTRYPOINT ["/app/entrypoint.sh"]
3636
3737FROM base AS builder
3838
39- RUN pip install poetry
39+ RUN --mount=type=cache,target=/root/.cache/pip \
40+ pip install poetry
4041
4142COPY ./pyproject.toml ./poetry.lock* ./
4243RUN --mount=type=cache,target=/root/.cache/pypoetry \
@@ -54,6 +55,11 @@ COPY --from=builder /app/.venv/ /app/.venv/
5455COPY ./syncmaster/ /app/syncmaster/
5556RUN python -m compileall -b syncmaster
5657
58+ # Do not run production as root, to improve security.
59+ # Also user does not own anything inside the image, including venv and source code.
60+ RUN useradd syncmaster
61+ USER syncmaster
62+
5763
5864FROM builder AS test
5965
Original file line number Diff line number Diff line change @@ -29,7 +29,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
2929 libkrb5-dev \
3030 && rm -rf /var/lib/apt/lists/* /var/cache/*
3131
32- RUN pip install poetry
32+ RUN --mount=type=cache,target=/root/.cache/pip \
33+ pip install poetry
3334
3435COPY ./pyproject.toml ./poetry.lock ./
3536RUN --mount=type=cache,target=/root/.cache/pypoetry \
@@ -47,6 +48,11 @@ COPY --from=builder /app/.venv/ /app/.venv/
4748COPY ./syncmaster/ /app/syncmaster/
4849RUN python -m compileall syncmaster
4950
51+ # Do not run production as root, to improve security.
52+ # Also user does not own anything inside the image, including venv and source code.
53+ RUN useradd syncmaster
54+ USER syncmaster
55+
5056
5157FROM builder AS test
5258
You can’t perform that action at this time.
0 commit comments