forked from AuroraMiddleware/gtk
ci: Add no-cache option to run-docker.sh script
Use `run-docker.sh build --no-cache` to discard the cached layers if you need to rebuild the image without modifying the Dockerfile.
This commit is contained in:
parent
864fbf89cd
commit
ec7b1f7208
@ -23,6 +23,7 @@ push=0
|
|||||||
list=0
|
list=0
|
||||||
print_help=0
|
print_help=0
|
||||||
no_login=0
|
no_login=0
|
||||||
|
no_cache=0
|
||||||
|
|
||||||
while (($# > 0)); do
|
while (($# > 0)); do
|
||||||
case "${1%%=*}" in
|
case "${1%%=*}" in
|
||||||
@ -34,6 +35,7 @@ while (($# > 0)); do
|
|||||||
--base|-b) read_arg base "$@" || shift;;
|
--base|-b) read_arg base "$@" || shift;;
|
||||||
--version|-v) read_arg base_version "$@" || shift;;
|
--version|-v) read_arg base_version "$@" || shift;;
|
||||||
--no-login) no_login=1;;
|
--no-login) no_login=1;;
|
||||||
|
--no-cache) no_cache=1;;
|
||||||
*) echo -e "\e[1;31mERROR\e[0m: Unknown option '$1'"; exit 1;;
|
*) echo -e "\e[1;31mERROR\e[0m: Unknown option '$1'"; exit 1;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
@ -103,11 +105,21 @@ TAG="${REGISTRY}/gnome/gtk/${base}:${base_version}"
|
|||||||
|
|
||||||
if [ $build == 1 ]; then
|
if [ $build == 1 ]; then
|
||||||
echo -e "\e[1;32mBUILDING\e[0m: ${base} as ${TAG}"
|
echo -e "\e[1;32mBUILDING\e[0m: ${base} as ${TAG}"
|
||||||
${CMD} build \
|
if [ $no_cache == 0 ]; then
|
||||||
${format} \
|
${CMD} build \
|
||||||
--build-arg HOST_USER_ID="$UID" \
|
${format} \
|
||||||
--tag "${TAG}" \
|
--build-arg HOST_USER_ID="$UID" \
|
||||||
--file "${base}.Dockerfile" .
|
--tag "${TAG}" \
|
||||||
|
--file "${base}.Dockerfile" .
|
||||||
|
else
|
||||||
|
${CMD} build \
|
||||||
|
${format} \
|
||||||
|
--no-cache \
|
||||||
|
--build-arg HOST_USER_ID="$UID" \
|
||||||
|
--tag "${TAG}" \
|
||||||
|
--file "${base}.Dockerfile" .
|
||||||
|
fi
|
||||||
|
|
||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user