1
0
intel-media-ffmpeg/scripts/build-image.sh
James Ketrenos 6ee00429ed Updated to latest xe-solutions
Signed-off-by: James Ketrenos <james.p.ketrenos@intel.com>
2019-11-19 15:29:54 -08:00

80 lines
1.7 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-${OS_DISTRO}-${PACKAGE_STREAM}-$(date +%Y%m%d)}
} || {
TAG=${TAG:-test-${OS_DISTRO}-${PACKAGE_STREAM}-${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
[[ ! -e "Dockerfile${SOLUTION_SUFFIX}" ]] && {
cat << EOF
'${OS_DISTRO}' set as OS_DISTRO, but Dockerfile${SOLUTION_SUFFIX} does$
Using Dockerfile instead.
EOF
SOLUTION_SUFFIX=""
}
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