Repository navigation
docs: add missing libatomic runtime to the smaller-image examples - #2685
Conversation
| @@ -197,7 +197,7 @@ The examples below build with npm. | |||
| ```Dockerfile | |||
| ARG ALPINE_VERSION=3.23 | |||
There was a problem hiding this comment.
| ARG ALPINE_VERSION=3.23 | |
| ARG ALPINE_VERSION=3.24 |
This should also be updated, as Alpine Linux 3.25 is expected soon, and then Alpine Linux 3.23 will be dropped from Node.js Docker builds.
| # Add required binaries; libstdc++ and libatomic are runtime dependencies of the | ||
| # official musl build of Node.js |
There was a problem hiding this comment.
| # Add required binaries; libstdc++ and libatomic are runtime dependencies of the | |
| # official musl build of Node.js | |
| # Add required binaries |
Keep the comments simple, otherwise you have to start to explain that libatomic is only required for Node.js >=25.
| # Add required binaries; libatomic1 is a runtime dependency of the official | ||
| # Linux builds of Node.js | ||
| RUN apt-get update && apt-get install -y --no-install-recommends dumb-init libatomic1 \ |
There was a problem hiding this comment.
| # Add required binaries; libatomic1 is a runtime dependency of the official | |
| # Linux builds of Node.js | |
| RUN apt-get update && apt-get install -y --no-install-recommends dumb-init libatomic1 \ | |
| # Add required binaries | |
| RUN apt-get update && apt-get install -y --no-install-recommends libatomic1 dumb-init \ |
Keep comments simple and use the same order of dependencies as for Alpine.
MikeMcC399
left a comment
There was a problem hiding this comment.
Please review and make the suggested changes
That is not a correct conclusion. If you test an update to Node.js 26 on Alpine you find it also fails on amd64. This is because alpine amd64 images are built from source using the official x64 Node.js musl binary. |
Node.js >=25 links libatomic, so both examples fail on amd64 without it. Also update the builder stages to node:26 and Alpine 3.24.
c32ec9d to
10d7f3f
Compare
|
Thanks, my explanation was wrong (the description is updated). Only All three suggestions are applied in 10d7f3f. |
MikeMcC399
left a comment
There was a problem hiding this comment.
Thank you for your contribution and for making the changes.
It looks good now. I also ran the examples in my own fork to confirm.
Description
Both examples under Smaller images without npm/yarn copy only the
nodebinary into a barealpine/debian:trixie-slimstage, so every runtime library of the official images has to be reinstalled by hand.libatomicwas missing from both.Also moves the builder stages to
node:26-*and Alpine 3.24, and uses the same dependency order in both examples.Motivation and Context
Following the guide produces an image that builds and then fails to start
node. Since Node.js 25 the official Linux binaries linklibatomic, whichDockerfile-alpine.templateinstalls since #2621 andDockerfile-slim.templatehas installed for longer.Testing Details
readelf -don thenodebinary copied out of each builder image (v26.13.0):libatomic.so.1node:26-alpine3.24node:26-alpine3.24node:26-trixie-slimnode:26-trixie-slimOnly
x64uses the official musl tarball, other architectures are still built from source, so the Alpine example breaks on amd64 only. Verified it starts on arm64 withlibstdc++alone.npm run format:toc:check,format:prettier:checkandformat:javascript:checkpass.Example Output
Types of changes
Checklist