-cd $WORKSPACE/$DOCKER_DIR
-HOST_ARCH=$(uname -m)
-if [ ! -f "${DOCKERFILE}" ]; then
- # If this is expected to be a Dockerfile for other arch than x86
- # and it does not exist, but there is a patch for the said arch,
- # then apply the patch and create the Dockerfile.${HOST_ARCH} file
- if [[ "${DOCKERFILE}" == *"${HOST_ARCH}" && \
- -f "Dockerfile.${HOST_ARCH}.patch" ]]; then
- patch -o Dockerfile."${HOST_ARCH}" Dockerfile \
- Dockerfile."${HOST_ARCH}".patch
- else
- echo "ERROR: No Dockerfile or ${HOST_ARCH} patch found."
+
+count=30 # docker build jobs might take up to ~30 min
+while [[ -n `ps -ef| grep 'docker build' | grep $DOCKER_REPO_NAME | grep -v grep` ]]; do
+ echo "Build or cleanup of $DOCKER_REPO_NAME in progress. Waiting..."
+ sleep 60
+ count=$(( $count - 1 ))
+ if [ $count -eq 0 ]; then
+ echo "Timeout. Aborting..."