[docker] forward arguments to 'docker build' command

This commit is contained in:
Simon Schön 2022-07-02 19:50:07 +02:00
parent 2a179e76a5
commit cd5fabf53e
No known key found for this signature in database
GPG Key ID: FD1F8B45F65D5B10

View File

@ -30,6 +30,9 @@ function runDockerBuild()
if [ -z "${LOG_FILE}" ]; then ${BUILD_CMD}; else ${BUILD_CMD} &>> "${LOG_FILE}"; fi if [ -z "${LOG_FILE}" ]; then ${BUILD_CMD}; else ${BUILD_CMD} &>> "${LOG_FILE}"; fi
if [ $? -ne 0 ]; then exit $?; fi if [ $? -ne 0 ]; then exit $?; fi
IMAGEID=$(docker images --format "{{.ID}} {{.CreatedAt}}" | sort -rk 2 | awk 'NR==1{print $1}');
appendOutput "\tImageId: ${IMAGEID}";
ENDTS=$(date +%s); ENDTS=$(date +%s);
DIFSEC=$((${ENDTS}-${STARTTS})); DIFSEC=$((${ENDTS}-${STARTTS}));
@ -45,7 +48,7 @@ function runDockerBuild()
else appendOutput "\tBuild time: ${TMPMIN} min ${TMPSEC} sec"; fi else appendOutput "\tBuild time: ${TMPMIN} min ${TMPSEC} sec"; fi
else appendOutput "\tBuild time: ${DIFSEC} sec"; fi else appendOutput "\tBuild time: ${DIFSEC} sec"; fi
IMG_SIZE=$(docker image inspect meshcentral | grep -e "\"Size\"" | tr -d '",' | sed -E "s/\s*Size:\s*//"); IMG_SIZE=$(docker image inspect ${IMAGEID} | grep -o '"Size":\s*[^,]*' | cut -f2- -d ':' | tr -d ' ');
expr $IMG_SIZE + 0 > /dev/null; expr $IMG_SIZE + 0 > /dev/null;
appendOutput "\tImage size: ${IMG_SIZE} ($((${IMG_SIZE}/1024/1024))M)\n"; appendOutput "\tImage size: ${IMG_SIZE} ($((${IMG_SIZE}/1024/1024))M)\n";
@ -58,17 +61,32 @@ if [ "${parent_path}" != "$(pwd -P)" ]; then
cd "${parent_path}"; cd "${parent_path}";
fi fi
if ! [ -z $1 ] && [ "${1}" == "prune" ]; then PRUNE="true"; fi if ! [ -z $1 ]; then
for arg in "$@"
do
case "${arg}" in
--prune)
PRUNE="true";
shift 1;
;;
*)
break;
;;
esac
done
fi
#runDockerBuild --build-arg DISABLE_MINIFY=yes --build-arg DISABLE_TRANSLATE=yes; MAINARGS=$@;
#runDockerBuild --build-arg DISABLE_TRANSLATE=yes;
#runDockerBuild --build-arg DISABLE_MINIFY=yes;
runDockerBuild;
#runDockerBuild --build-arg INCLUDE_MONGODBTOOLS=yes --build-arg DISABLE_MINIFY=yes --build-arg DISABLE_TRANSLATE=yes; #runDockerBuild --build-arg DISABLE_MINIFY=yes --build-arg DISABLE_TRANSLATE=yes ${MAINARGS};
#runDockerBuild --build-arg INCLUDE_MONGODBTOOLS=yes --build-arg DISABLE_TRANSLATE=yes; #runDockerBuild --build-arg DISABLE_TRANSLATE=yes ${MAINARGS};
#runDockerBuild --build-arg INCLUDE_MONGODBTOOLS=yes --build-arg DISABLE_MINIFY=yes; #runDockerBuild --build-arg DISABLE_MINIFY=yes ${MAINARGS};
#runDockerBuild --build-arg INCLUDE_MONGODBTOOLS=yes; runDockerBuild ${MAINARGS};
#runDockerBuild --build-arg INCLUDE_MONGODBTOOLS=yes --build-arg DISABLE_MINIFY=yes --build-arg DISABLE_TRANSLATE=yes ${MAINARGS};
#runDockerBuild --build-arg INCLUDE_MONGODBTOOLS=yes --build-arg DISABLE_TRANSLATE=yes ${MAINARGS};
#runDockerBuild --build-arg INCLUDE_MONGODBTOOLS=yes --build-arg DISABLE_MINIFY=yes ${MAINARGS};
#runDockerBuild --build-arg INCLUDE_MONGODBTOOLS=yes ${MAINARGS};
echo ""; echo "";
echo -e "${MSG}"; echo -e "${MSG}";