Fixes #988 run_in_docker.sh only works with gcr.io

This commit is contained in:
Sam Stoelinga 2020-01-22 17:03:43 -08:00
parent 6e80e627ac
commit 509afaf112
1 changed files with 17 additions and 11 deletions

View File

@ -30,15 +30,21 @@ if [[ ! -z "$4" ]]; then
cache=$4 cache=$4
fi fi
if [[ ! -e $HOME/.config/gcloud/application_default_credentials.json ]]; then if [[ $destination == *"gcr"* ]]; then
echo "Application Default Credentials do not exist. Run [gcloud auth application-default login] to configure them" if [[ ! -e $HOME/.config/gcloud/application_default_credentials.json ]]; then
exit 1 echo "Application Default Credentials do not exist. Run [gcloud auth application-default login] to configure them"
exit 1
fi
docker run \
-v "$HOME"/.config/gcloud:/root/.config/gcloud \
-v "$context":/workspace \
gcr.io/kaniko-project/executor:latest \
--dockerfile "${dockerfile}" --destination "${destination}" --context dir:///workspace/ \
--cache="${cache}"
else
docker run \
-v "$context":/workspace \
gcr.io/kaniko-project/executor:latest \
--dockerfile "${dockerfile}" --destination "${destination}" --context dir:///workspace/ \
--cache="${cache}"
fi fi
docker run \
-v "$HOME"/.config/gcloud:/root/.config/gcloud \
-v "$context":/workspace \
gcr.io/kaniko-project/executor:latest \
--dockerfile "${dockerfile}" --destination "${destination}" --context dir:///workspace/ \
--cache="${cache}"