Skip to content

Commit 8507f48

Browse files
authored
Merge pull request #100 from emanzx/fix/dockerfile-libz
fix(docker): add libz.so.1 to runtime image
2 parents 1d13629 + 749614f commit 8507f48

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,23 @@ USER nonroot:nonroot
4545

4646
COPY --from=builder --chown=nonroot:nonroot /build/target/release/nodedb /usr/local/bin/nodedb
4747

48+
# nodedb dynamically links libz.so.1 (transitively via crates that default to
49+
# system zlib — e.g. flate2 with its default `zlib` feature). Chainguard's
50+
# glibc-dynamic ships only glibc + libgcc + ca-certs + tzdata, so the runtime
51+
# fails immediately with: "error while loading shared libraries: libz.so.1:
52+
# cannot open shared object file: No such file or directory".
53+
#
54+
# Copy the Debian builder's libz into a default ld.so search path. The glob
55+
# covers both amd64 and arm64 — per-arch builds only see their own multiarch
56+
# directory, so exactly one match per build.
57+
#
58+
# Long-term cleanup options (any of these would let us drop this COPY):
59+
# * Switch flate2 (and any other zlib-using deps) to the `rust_backend`
60+
# feature so libz becomes a build-time C lib statically linked.
61+
# * Or vendor libz via the `libz-sys` `static` feature.
62+
# * Or move runtime to `cgr.dev/chainguard/wolfi-base` + `apk add zlib`.
63+
COPY --from=builder /lib/*-linux-gnu/libz.so.1 /usr/lib/libz.so.1
64+
4865
# Bind to all interfaces (required for Docker port mapping)
4966
# Point data dir at the declared volume
5067
ENV NODEDB_HOST=0.0.0.0 \

0 commit comments

Comments
 (0)