intel-device-plugins-for-ku.../build/docker/build-image.sh
Mikko Ylinen 23598e7839 build-image: always pull the latest base image
With this change, we make sure the local build always pulls the
latest version of the base image.

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2019-05-14 20:39:36 +03:00

30 lines
655 B
Bash
Executable File

#!/bin/sh -e
IMG=$1
BUILDER=$2
DOCKERFILE="$(dirname $0)/${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
TAG=$(git rev-parse HEAD)
if [ -z "${BUILDER}" -o "${BUILDER}" = 'docker' ] ; then
docker build --pull -t ${IMG}:${TAG} -f ${DOCKERFILE} .
docker tag ${IMG}:${TAG} ${IMG}:devel
elif [ "${BUILDER}" = 'buildah' ] ; then
buildah bud --pull-always -t ${IMG}:${TAG} -f ${DOCKERFILE} .
buildah tag ${IMG}:${TAG} ${IMG}:devel
else
(>&2 echo "Unknown builder ${BUILDER}")
exit 1
fi