Repository navigation
Improve: smaller image and one nginx worker - #549
Merged
Merged
Conversation
- Copy the cleaned Node base into a scratch stage so the removed npm, yarn, corepack and C headers no longer ship in a lower layer (about 24 MB smaller). - Remove /usr/local/include/node from the runtime image. - Set nginx worker_processes to 1 instead of one worker per host core. - Update the Dockerfile shape tests for the new stages.
Reset every directory time in the base stage to the node binary's time, so COPY --from=base produces the same layer for one base digest and updates reuse it. Fail the build if node.h is still anywhere in the image. Check every shipped stage, not only the last, in the runtime-content tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
base, then copy it into aFROM scratchstage withCOPY --from=base / /so the deleted npm, yarn, corepack and C headers no longer ship in a lower layer. The image is about 24 MB smaller on disk and about 7 MB smaller compressed, on amd64 and arm64./usr/local/include/nodefrom the runtime image, and fail the build ifnode.his still anywhere in it.basestage to the node binary's time, so the copied layer is identical for one base digest and updates reuse it.worker_processes 1instead ofautowithsed, and fail the build withgrep -qxif the line does not apply.autostarts one worker per host core and ignores container CPU limits.NODE_VERSIONandYARN_VERSIONare no longer set in the image. Nothing reads them.Testing
All green, including the Docker build and image scan. Added 2 tests for the nginx worker setting and the reproducible base layer.
Changelog
Changed
Checklist