1
0
James Ketrenos 82aba14ec6 Red Hat images can now be built and pushed. See README.md
Signed-off-by: James Ketrenos <james.p.ketrenos@intel.com>
2019-11-07 11:59:01 -08:00

61 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Determine if it is Mac OS and switch to use gxargs instead
CMD=xargs
if [ $(which system_profiler) ]; then
CMD=gxargs
fi
# Bring in the variables from SOLUTION file, supporting
# nested substitution
. SOLUTION
. MANIFEST
export $(sed -nE "s,(^[^#][^=]*).*$,\1,pg" SOLUTION | ${CMD} -d '\n')
export $(sed -nE "s,(^[^#][^=]*).*$,\1,pg" MANIFEST | ${CMD} -d '\n')
AGAMA_VERSION=${AGAMA_VERSION:-N/A}
[[ "${AGAMA_VERSION}" == "N/A" ]] && {
TAG=${TAG:-test-build-${PACKAGE_STREAM}-$(date +%Y%m%d)}
} || {
TAG=${TAG:-test-agama-${AGAMA_VERSION}}
}
case "${OS_DISTRO}" in
rhel)
SOLUTION_SUFFIX=".rhel-8.0"
;;
ubuntu)
SOLUTION_SUFFIX=""
;;
*)
echo "Unrecognized OS_DISTRO: '${OS_DISTRO}'"
exit -1
;;
esac
export DOCKERFILE="Dockerfile${SOLUTION_SUFFIX}"
export SOLUTION="Dockerfile.solution${SOLUTION_SUFFIX}"
docker build -t ${CONTAINER}:${TAG} -f ${DOCKERFILE} . $* || {
cat << EOM
Building docker image from ${DOCKERFILE} failed.
EOM
exit -1
}
docker tag ${CONTAINER}:${TAG} ${CONTAINER} || {
echo "Unable to tag docker image"
exit -1
}
cat << EOM
${DOCKERFILE} was built and locally tagged as ${CONTAINER}:${TAG}
See 'scripts/push-images' for information on pushing this tag to Harbor.
EOM