Skip to content

Commit e02c480

Browse files
committed
images: use buildkit again
The Toybox images had two issues: 1. Distroless does not support /bin -> /usr/bin so we needed to create it manually to get /bin/bash for Toybox. However, with this Openshift image validation complains that we are touching the "base" image. 2. We could not use buildkit since it fails with /bin symlink copied over /bin directory from Distroless. The simple fix is just to move away from all /bin/sh and /bin/bash and use "/usr/bin/env bash" to resolve the path instead. This allows to keep /bin untouched. Signed-off-by: Mikko Ylinen <[email protected]>
1 parent 56d747e commit e02c480

16 files changed

+18
-23
lines changed

build/docker/build-image.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ fi
3131

3232
BUILD_ARGS="${BUILD_ARGS} --build-arg FINAL_BASE=gcr.io/distroless/static"
3333
if [ -z "${BUILDER}" -o "${BUILDER}" = 'docker' -o "${BUILDER}" = 'podman' ] ; then
34-
DOCKER_BUILDKIT=0 ${BUILDER} build --pull -t ${IMG}:${TAG} ${BUILD_ARGS} -f ${DOCKERFILE} .
34+
${BUILDER} build --pull -t ${IMG}:${TAG} ${BUILD_ARGS} -f ${DOCKERFILE} .
3535
elif [ "${BUILDER}" = 'buildah' ] ; then
3636
BUILDAH_RUNTIME=runc buildah bud --pull-always -t ${IMG}:${TAG} ${BUILD_ARGS} -f ${DOCKERFILE} .
3737
else

build/docker/intel-dlb-initcontainer.Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ RUN curl -SL https://github.com/landley/toybox/archive/refs/tags/$TOYBOX_VERSION
5151
&& rm toybox.tar.gz \
5252
&& cd toybox-$TOYBOX_VERSION \
5353
&& KCONFIG_CONFIG=${DIR}/build/docker/toybox-config-$(echo ${FINAL_BASE} | xargs basename -s :latest) LDFLAGS="--static" CC=musl-gcc PREFIX=$ROOT/usr/bin V=2 make toybox install_flat \
54-
&& cd $ROOT && ln -fs usr/bin bin && cd - \
5554
&& install -D LICENSE $ROOT/licenses/toybox \
5655
&& cp -r /usr/share/doc/musl $ROOT/licenses/
5756
###
@@ -61,4 +60,4 @@ LABEL version='devel'
6160
LABEL release='1'
6261
COPY --from=builder /install_root /
6362
COPY demo/dlb-init.sh /usr/local/bin/
64-
ENTRYPOINT [ "/bin/bash", "/usr/local/bin/dlb-init.sh"]
63+
ENTRYPOINT ["/usr/local/bin/dlb-init.sh"]

build/docker/intel-fpga-initcontainer.Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ RUN curl -SL https://github.com/landley/toybox/archive/refs/tags/$TOYBOX_VERSION
8585
&& rm toybox.tar.gz \
8686
&& cd toybox-$TOYBOX_VERSION \
8787
&& KCONFIG_CONFIG=${DIR}/build/docker/toybox-config-$(echo ${FINAL_BASE} | xargs basename -s :latest) LDFLAGS="--static" CC=musl-gcc PREFIX=$ROOT/usr/bin V=2 make toybox install_flat \
88-
&& cd $ROOT && ln -fs usr/bin bin && cd - \
8988
&& install -D LICENSE $ROOT/licenses/toybox \
9089
&& cp -r /usr/share/doc/musl $ROOT/licenses/
9190
###
@@ -97,4 +96,4 @@ LABEL name='intel-fpga-initcontainer'
9796
LABEL summary='Intel® FPGA programming CRI hook for Kubernetes'
9897
LABEL description='The FPGA prestart CRI-O hook performs discovery of the requested FPGA function bitstream and programs FPGA devices based on the environment variables in the workload description'
9998
COPY --from=builder /install_root /
100-
ENTRYPOINT [ "/bin/sh", "-c", "cp -a /usr/local/fpga-sw/* /opt/intel/fpga-sw/ && ln -sf /opt/intel/fpga-sw/intel-fpga-crihook.json /etc/containers/oci/hooks.d/" ]
99+
ENTRYPOINT [ "/usr/bin/sh", "-c", "cp -a /usr/local/fpga-sw/* /opt/intel/fpga-sw/ && ln -sf /opt/intel/fpga-sw/intel-fpga-crihook.json /etc/containers/oci/hooks.d/" ]

build/docker/intel-gpu-initcontainer.Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ RUN curl -SL https://github.com/landley/toybox/archive/refs/tags/$TOYBOX_VERSION
6868
&& rm toybox.tar.gz \
6969
&& cd toybox-$TOYBOX_VERSION \
7070
&& KCONFIG_CONFIG=${DIR}/build/docker/toybox-config-$(echo ${FINAL_BASE} | xargs basename -s :latest) LDFLAGS="--static" CC=musl-gcc PREFIX=$ROOT/usr/bin V=2 make toybox install_flat \
71-
&& cd $ROOT && ln -fs usr/bin bin && cd - \
7271
&& install -D LICENSE $ROOT/licenses/toybox \
7372
&& cp -r /usr/share/doc/musl $ROOT/licenses/
7473
###
@@ -80,4 +79,4 @@ LABEL name='intel-gpu-initcontainer'
8079
LABEL summary='Intel® GPU NFD hook for Kubernetes'
8180
LABEL description='The GPU fractional resources, such as GPU memory is registered as a kubernetes extended resource using node-feature-discovery (NFD). A custom NFD source hook is installed as part of GPU device plugin operator deployment and NFD is configured to register the GPU memory extended resource reported by the hook'
8281
COPY --from=builder /install_root /
83-
ENTRYPOINT [ "/bin/sh", "-c", "cp -a /usr/local/bin/gpu-sw/intel-gpu-nfdhook /etc/kubernetes/node-feature-discovery/source.d/" ]
82+
ENTRYPOINT [ "/usr/bin/sh", "-c", "cp -a /usr/local/bin/gpu-sw/intel-gpu-nfdhook /etc/kubernetes/node-feature-discovery/source.d/" ]

build/docker/intel-idxd-config-initcontainer.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ COPY demo/dsa.conf /idxd-init/
2121
COPY demo/iaa.conf /idxd-init/
2222
RUN mkdir /idxd-init/scratch
2323
WORKDIR /idxd-init
24-
ENTRYPOINT ["bash", "/usr/local/bin/idxd-init.sh"]
24+
ENTRYPOINT ["/usr/local/bin/idxd-init.sh"]

build/docker/intel-qat-initcontainer.Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ RUN curl -SL https://github.com/landley/toybox/archive/refs/tags/$TOYBOX_VERSION
5151
&& rm toybox.tar.gz \
5252
&& cd toybox-$TOYBOX_VERSION \
5353
&& KCONFIG_CONFIG=${DIR}/build/docker/toybox-config-$(echo ${FINAL_BASE} | xargs basename -s :latest) LDFLAGS="--static" CC=musl-gcc PREFIX=$ROOT/usr/bin V=2 make toybox install_flat \
54-
&& cd $ROOT && ln -fs usr/bin bin && cd - \
5554
&& install -D LICENSE $ROOT/licenses/toybox \
5655
&& cp -r /usr/share/doc/musl $ROOT/licenses/
5756
###
@@ -65,4 +64,4 @@ LABEL description='Intel QAT initcontainer initializes devices'
6564
COPY --from=builder /install_root /
6665
COPY demo/qat-init.sh /usr/local/bin/
6766
WORKDIR /qat-init
68-
ENTRYPOINT [ "/bin/bash", "/usr/local/bin/qat-init.sh"]
67+
ENTRYPOINT ["/usr/local/bin/qat-init.sh"]

build/docker/intel-sgx-initcontainer.Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ RUN curl -SL https://github.com/landley/toybox/archive/refs/tags/$TOYBOX_VERSION
6868
&& rm toybox.tar.gz \
6969
&& cd toybox-$TOYBOX_VERSION \
7070
&& KCONFIG_CONFIG=${DIR}/build/docker/toybox-config-$(echo ${FINAL_BASE} | xargs basename -s :latest) LDFLAGS="--static" CC=musl-gcc PREFIX=$ROOT/usr/bin V=2 make toybox install_flat \
71-
&& cd $ROOT && ln -fs usr/bin bin && cd - \
7271
&& install -D LICENSE $ROOT/licenses/toybox \
7372
&& cp -r /usr/share/doc/musl $ROOT/licenses/
7473
###
@@ -80,4 +79,4 @@ LABEL name='intel-sgx-initcontainer'
8079
LABEL summary='Intel® SGX NFD hook for Kubernetes'
8180
LABEL description='The SGX EPC memory available on each node is registered as a Kubernetes extended resource using node-feature-discovery (NFD). A custom NFD source hook is installed as part of SGX device plugin operator deployment and NFD is configured to register the SGX EPC memory extended resource reported by the hook'
8281
COPY --from=builder /install_root /
83-
ENTRYPOINT [ "/bin/sh", "-c", "cp -a /usr/local/bin/sgx-sw/intel-sgx-epchook /etc/kubernetes/node-feature-discovery/source.d/" ]
82+
ENTRYPOINT [ "/usr/bin/sh", "-c", "cp -a /usr/local/bin/sgx-sw/intel-sgx-epchook /etc/kubernetes/node-feature-discovery/source.d/" ]

build/docker/lib/nfdhook_end.docker

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
#define string(s) #s
44

55
COPY --from=builder /install_root /
6-
ENTRYPOINT [ "/bin/sh", "-c", xstring(_ENTRYPOINT_) ]
6+
ENTRYPOINT [ "/usr/bin/sh", "-c", xstring(_ENTRYPOINT_) ]

build/docker/lib/toybox_build.docker

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ RUN curl -SL https://github.com/landley/toybox/archive/refs/tags/$TOYBOX_VERSION
1212
&& rm toybox.tar.gz \N
1313
&& cd toybox-$TOYBOX_VERSION \N
1414
&& KCONFIG_CONFIG=${DIR}/build/docker/toybox-config-$(echo ${FINAL_BASE} | xargs basename -s :latest) LDFLAGS="--static" CC=musl-gcc PREFIX=$ROOT/usr/bin V=2 make toybox install_flat \N
15-
&& cd $ROOT && ln -fs usr/bin bin && cd - \N
1615
&& install -D LICENSE $ROOT/licenses/toybox \N
1716
&& cp -r /usr/share/doc/musl $ROOT/licenses/
1817
###

build/docker/templates/intel-dlb-initcontainer.Dockerfile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ FROM ${FINAL_BASE}
1616
COPY --from=builder /install_root /
1717

1818
COPY demo/dlb-init.sh /usr/local/bin/
19-
ENTRYPOINT [ "/bin/bash", "/usr/local/bin/dlb-init.sh"]
19+
ENTRYPOINT ["/usr/local/bin/dlb-init.sh"]

0 commit comments

Comments
 (0)