Fix ldconfig library cache so ELF binaries work

This commit is contained in:
Joe Groocock 2017-08-15 23:14:46 +01:00
parent feb1b2c5d0
commit 829a3150de
Signed by: frebib
GPG Key ID: E0B16BEACFBB6A86
2 changed files with 6 additions and 5 deletions

View File

@ -18,6 +18,7 @@ pipeline:
commands:
- docker run --rm devbuild /bin/sh -xec 'true'
- docker run --rm devbuild /bin/sh -xec 'test -f /lib/libc-*.so'
- docker run --rm devbuild /bin/sh -xec 'ldconfig -p'
- docker run --rm devbuild /bin/sh -xec 'nslookup google.com'
- test "$(docker run --rm devbuild /bin/sh -xec 'date +%Z')" = 'UTC'
- test "$(docker run --rm devbuild /bin/sh -xec 'echo This is a test string | md5sum | cut -f1 -d\ ' | tee /dev/stderr)" = 'b584c39f97dfe71ebceea3fdb860ed6c'

View File

@ -34,9 +34,6 @@ RUN curl -fL https://ftp.gnu.org/gnu/glibc/glibc-${GLIBC_VER}.tar.xz \
echo "rootsbindir=/sbin" >> configparms && \
echo "build-programs=yes" >> configparms && \
\
# Fix debian lib path weirdness
rm -rf /usr/include/${ARCH}-linux-gnu/c++ && \
\
exec >/dev/null && \
../configure \
--prefix= \
@ -91,6 +88,11 @@ RUN for f in passwd shadow group profile; do \
# Copy UTC localtime to output
cp /usr/share/zoneinfo/Etc/UTC etc/
# Generate initial ld.so.cache so ELF binaries work.
# This is important otherwise everything will error with
# 'no such file or directory' when looking for libraries
RUN ${PREFIX}/sbin/ldconfig -r ${PREFIX}
# =============
FROM scratch
@ -99,7 +101,5 @@ WORKDIR /
COPY --from=builder /output/ /
RUN mkdir -p /tmp && \
chmod 1777 /tmp
RUN ldconfig && \
ldconfig -p
CMD ["/bin/sh"]