Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ FROM builder-base AS builder-runtime
RUN --mount=type=cache,target=${POETRY_CACHE_DIR} \
poetry install --no-root --no-interaction --only main

# pip is not needed at runtime. Its vendored dependencies (urllib3, msgpack, setuptools)
# show up in image scans and lag behind the application's own pinned versions.
RUN rm -rf ${VIRTUAL_ENV}/bin/pip* ${VIRTUAL_ENV}/lib/python*/site-packages/pip ${VIRTUAL_ENV}/lib/python*/site-packages/pip-*.dist-info

# Development dependencies builder (full deps, poetry available)
FROM builder-base AS builder-dev

Expand All @@ -94,6 +98,9 @@ ENV VIRTUAL_ENV="${VIRTUAL_ENV_PATH}"
ENV PATH="${VIRTUAL_ENV}/bin:$PATH" \
PYTHONPATH="${PROJECT_DIR}"

# remove the base image's pip; the runtime image never installs packages
RUN python -m pip uninstall -y pip

# Copy only the virtualenv — no pip, no build tools
COPY --from=builder-runtime --chown=${APP_USER}:${APP_GROUP} ${VIRTUAL_ENV} ${VIRTUAL_ENV}

Expand Down
Loading
Loading