mirror of
https://github.com/intel/intel-device-plugins-for-kubernetes.git
synced 2025-06-03 03:59:37 +00:00

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 <mikko.ylinen@intel.com>
41 lines
1.0 KiB
Bash
Executable File
41 lines
1.0 KiB
Bash
Executable File
#!/bin/sh -e
|
|
|
|
IMG=$1
|
|
|
|
DOCKERFILE="$(dirname $0)/$(basename ${IMG}).Dockerfile"
|
|
|
|
if [ -z "$IMG" ]; then
|
|
(>&2 echo "Usage: $0 <Dockerfile>")
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -e "${DOCKERFILE}" ]; then
|
|
(>&2 echo "File ${DOCKERFILE} doesn't exist")
|
|
exit 1
|
|
fi
|
|
|
|
shift
|
|
|
|
if [ "$1" = 'docker' -o "$1" = 'buildah' -o "$1" = 'podman' ]; then
|
|
BUILDER=$1
|
|
shift
|
|
fi
|
|
|
|
TAG=${TAG:-devel}
|
|
|
|
BUILD_ARGS=$@
|
|
if [ -d $(dirname $0)/../../vendor ] ; then
|
|
echo "Building images with vendored code"
|
|
BUILD_ARGS="${BUILD_ARGS} --build-arg DIR=/go/src/github.com/intel/intel-device-plugins-for-kubernetes --build-arg GO111MODULE=off"
|
|
fi
|
|
|
|
BUILD_ARGS="${BUILD_ARGS} --build-arg FINAL_BASE=gcr.io/distroless/static"
|
|
if [ -z "${BUILDER}" -o "${BUILDER}" = 'docker' -o "${BUILDER}" = 'podman' ] ; then
|
|
${BUILDER} build --pull -t ${IMG}:${TAG} ${BUILD_ARGS} -f ${DOCKERFILE} .
|
|
elif [ "${BUILDER}" = 'buildah' ] ; then
|
|
BUILDAH_RUNTIME=runc buildah bud --pull-always -t ${IMG}:${TAG} ${BUILD_ARGS} -f ${DOCKERFILE} .
|
|
else
|
|
(>&2 echo "Unknown builder ${BUILDER}")
|
|
exit 1
|
|
fi
|