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
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,17 @@ RUN --mount=type=cache,target=/root/.cache/uv \
RUN rm -rf "${VIRTUAL_ENV}"/lib/python*/site-packages/docs \
"${VIRTUAL_ENV}"/lib/python*/site-packages/examples

# Most wheels ship their compiled extensions unstripped, carrying symbol tables and debug info that nothing needs at runtime.
# Stripping them here keeps ~130 MB out of the runtime image, which copies only the result of this stage.
# --strip-unneeded leaves everything that dynamic linking uses, so the extensions stay loadable.
# binutils only reaches this stage as a transitive of the gcc install above, so check for strip explicitly:
# the trailing `|| true` is there for individual files strip cannot handle, and would otherwise hide a missing binutils.
RUN command -v strip > /dev/null || { \
echo "strip not found: the builder stage needs binutils" >&2; exit 1; \
}; \
find "${VIRTUAL_ENV}" \( -name '*.so' -o -name '*.so.*' \) -type f \
-exec strip --strip-unneeded {} + 2>/dev/null || true

# Use a separate runtime image to run the code
FROM python:${PYTHON_VERSION}-slim-${DEBIAN_VERSION} AS runtime

Expand Down
2 changes: 1 addition & 1 deletion documentation/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ New features

Infrastructure / Support
-------------------------
* Shrink the Docker image by excluding dev-only dependencies and pruning stray ``docs``/``examples`` payloads bundled by ``sktime``/``scikit-base`` (issue: https://github.com/sktime/sktime/issues/10891) [see `PR #2438 <https://www.github.com/FlexMeasures/flexmeasures/pull/2438>`_]
* Shrink the Docker image by excluding dev-only dependencies, pruning stray ``docs``/``examples`` payloads bundled by ``sktime``/``scikit-base`` (issue: https://github.com/sktime/sktime/issues/10891), and stripping the symbol tables that the compiled extensions ship with [see `PR #2438 <https://www.github.com/FlexMeasures/flexmeasures/pull/2438>`_ and `PR #2439 <https://www.github.com/FlexMeasures/flexmeasures/pull/2439>`_]

Bugfixes
-----------
Expand Down
Loading