1
0
intel-media-ffmpeg/scripts/build-image.sh
James Ketrenos 93074d8fd8 Updated to latest xe-solutions
Signed-off-by: James Ketrenos <james.p.ketrenos@intel.com>
2019-11-13 12:09:36 -08:00

70 lines
1.5 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')
RELEASE_INFO=${RELEASE_INFO:-N/A}
[[ "${RELEASE_INFO}" == "N/A" ]] && {
TAG=${TAG:-test-build-${PACKAGE_STREAM}-$(date +%Y%m%d)}
} || {
TAG=${TAG:-test-${RELEASE_INFO}}
}
case "${OS_DISTRO}" in
rhel)
SOLUTION_SUFFIX=".rhel-8.0"
;;
ubuntu)
SOLUTION_SUFFIX=""
;;
*)
SOLUTION_SUFFIX=".${OS_DISTRO}-${OS_RELEASE}"
[[ -d "templates/${OS_DISTRO}" ]] || {
echo "Unrecognized OS_DISTRO: '${OS_DISTRO}'"
exit -1
}
[[ ! -e "Dockerfile.solution.${SOLUTION_SUFFIX}" ]] && {
SOLUTION_SUFFIX=""
}
;;
esac
export DOCKERFILE="Dockerfile${SOLUTION_SUFFIX}"
export SOLUTION="Dockerfile.solution${SOLUTION_SUFFIX}"
echo "Building '${SOLUTION}' image from '${DOCKERFILE}'"
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