fix(template): use vips (not vips-dev) in prod runtime stage#216
Open
david-koller-xmv wants to merge 1 commit into
Open
fix(template): use vips (not vips-dev) in prod runtime stage#216david-koller-xmv wants to merge 1 commit into
david-koller-xmv wants to merge 1 commit into
Conversation
The runtime stage of Dockerfile-prod.liquid never compiles native code — sharp was already built against vips during the build stage. Shipping vips-dev in the final image only adds the C headers (~30 MB on alpine), which the runtime never reads. Switching to the slim vips package shaves ~30 MB off the production image with no behavioural change. Confirmed on linux/amd64 and linux/arm64 (Hetzner CAX / Ampere Altra) builds.
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
The runtime stage of
templates/Dockerfile-prod.liquidshipsvips-deveven though it never compiles native code. Switching to the slimvipspackage removes the unused C headers and shaves ~30 MB off the production image.Why
sharpis compiled againstlibvipsin the build stage wherevips-devis needed for the headers. By the time we reach the runtime stage, sharp's binary is already linked and only the runtime library is required. Alpine'svipspackage provides exactly that without the headers.Verified on
linux/amd64(GitHub Actions runner, native build)linux/arm64(Hetzner CAX / Ampere Altra, via QEMU buildx)Both architectures build cleanly and produce a working Strapi v5 image. No behavioural change at runtime; only the image is smaller.
Test plan
Dockerfile-prodsharpcontinues to work for image uploadsI'd like to follow up with a second PR adding a short ARM64 notes section to the README (covering
better-sqlite3placement and the--platformflag for QEMU builds) — keeping this PR scoped to the one-line image-shrinking change.