Skip to content

fix(template): use vips (not vips-dev) in prod runtime stage#216

Open
david-koller-xmv wants to merge 1 commit into
strapi-community:mainfrom
david-koller-xmv:fix/prod-runtime-vips
Open

fix(template): use vips (not vips-dev) in prod runtime stage#216
david-koller-xmv wants to merge 1 commit into
strapi-community:mainfrom
david-koller-xmv:fix/prod-runtime-vips

Conversation

@david-koller-xmv
Copy link
Copy Markdown

Summary

The runtime stage of templates/Dockerfile-prod.liquid ships vips-dev even though it never compiles native code. Switching to the slim vips package removes the unused C headers and shaves ~30 MB off the production image.

Why

sharp is compiled against libvips in the build stage where vips-dev is 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's vips package 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

  • CI builds both arches with the generated Dockerfile-prod
  • sharp continues to work for image uploads
  • Image size before/after comparison shows the expected drop

I'd like to follow up with a second PR adding a short ARM64 notes section to the README (covering better-sqlite3 placement and the --platform flag for QEMU builds) — keeping this PR scoped to the one-line image-shrinking change.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant