Skip to content

Distroless builds: Node-something-distroless examples + nginx + mcp server - #461

Open
cosmintanasa47 wants to merge 18 commits into
unikraft-cloud:mainfrom
cosmintanasa47:node-something-distroless
Open

cosmintanasa47 wants to merge 18 commits into
unikraft-cloud:mainfrom
cosmintanasa47:node-something-distroless

Conversation

@cosmintanasa47

Copy link
Copy Markdown

Those are the distroless examples for node distroless builds for non-httpserver examples. Details about the implementation in each modified files's commit message.

Use nodejs24-debian12 distroless image to run the server.
It fits best with the build image. Copy only necessary
executables and libraries. Out of the three executables
copied initially, only /bin/sh is mandatory because of
the entrypoint.sh scrypt that runs node.
Modify the exec command to be able to run node. It had to
match the distroless image's node path.

Previous: exec node ...
Current: exec /nodejs/bin/node ...
Slightly modify to fit new distroless version.
Slightly modify to fit new distroless version.
Unmodified files from non-distroless version.
Use bookworm for build stage to be compatible with
cc-debian12 distroless runtime image. Node's odd
versions do not have available distroless images
so used a cc image.
Slightly modify to fit new distroless version.
Slightly modify to fit new distroless version.
Unmodified files from non-distroless version.
Modify dockerfile so that it has a "runtime" stage that is
based on a distroless node18 image from google.

Kraftfile is modified so that node's path is the one
at which node is present in the distroless image.

Slightly modify test file and README to fit this
distroless version.
Add Dockerfile with an additional stage that is based
on a distroless node18 image from google.

Modify Kraftfile's node path so that it matches
distroless image's path to nodejs.

Slightly modify test file and README so they fit for
this new distroless version.
Modify Dockerfile so that it builds the second stage
with a distroless node22 image from google. This
eliminated the copying of node binary and libraries.

Modify Kraftfile so the node binary path fits distroless
image's node path.

Slightly modify test file and README to fit new distroless
version.

Kept unmodified from the original non-distroless version:
dockerignore, gitignore, package.json,wrapper.sh, server.js.
Modify Dockerfile so that it builds the second stage
with a distroless node22 image from google. This
eliminated the copying of node binary and libraries.

Modify Kraftfile so the node binary path fits distroless
image's node path.

Slightly modify test file and README to fit new distroless
version.

Kept unmodified from the original non-distroless version:
dockerignore, gitignore, package.json,wrapper.sh, server.js.
Modify Dockerfile so that it builds the second stage
with a distroless node22 image from google. This
eliminated the copying of node binary and libraries.

Modify Kraftfile so the node binary path fits distroless
image's node path.

Slightly modify test file and README to fit new distroless
version.

Kept unmodified from the original non-distroless version:
dockerignore, gitignore, package.json,wrapper.sh, server.js.
Modify Dockerfile to have a distroless "runtime" stage that
is based on a distroless node25 image.

Modify Kraftfile's node binary path and source file
path to fit to the disign of the used distroless image.

Slightly modify test file and README to fit new distroless version.

Didn't modify other files from non-distroless version.
Switch from a two-stage Dockerfile to a one-stage Dockerfile
so it uses a distroless nginx image that eliminates the copying
of system and nginx libraries.

Modify Kraftfile so nginx binary path respects the distroless
image's nginx binary path.

Slightly modify test file and README so it fits for the new
distroless version.

Didn't modify the other files added from the original
non-distroless version.
Modify Dockerfiles for each part to run on a distroless image.
For mongo and flask used a cc image because mongo do not
have a distroless docker image and python3.12 also do not
have an image, there are images compatible only with
python3.11 and python3.13.

Modify KRaftfiles to point to the exact paths for it's
binaries (nginx, python and mongod) considering the
distroless images. Same for entrypoint.sh.

Modify test file and README to fit new distroless version.
Modify Dockerfile so the server runs on a distroless image.
This excluded the copying of system and python libraries,
but also python interpretor and other libraries. The distroless
stage just copies the dependencies resolved in the build stage
and with a compatible interpretor it runs the python mcp server.

Modify README and test file so it fits the new distroless version.

Kraftfile and the rest of the files weren't modified. Those are
the same as the ones in the non-distroless example.
@cosmintanasa47 cosmintanasa47 changed the title Distroless builds: Node-something-distroless examples Distroless builds: Node-something-distroless examples + nginx + mcp server Sep 14, 2026
@cosmintanasa47

Copy link
Copy Markdown
Author

Also added two nginx examples and one mcp server.

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