Skip to content

Commit

Permalink
Merge pull request #990 from samos123/fix-988-run-in-docker-sh-non-gcr
Browse files Browse the repository at this point in the history
Fixes #988 run_in_docker.sh only works with gcr.io
  • Loading branch information
tejal29 authored Jan 28, 2020
2 parents 6c5002c + 509afaf commit 4919fb5
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions run_in_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,21 @@ if [[ ! -z "$4" ]]; then
cache=$4
fi

if [[ ! -e $HOME/.config/gcloud/application_default_credentials.json ]]; then
echo "Application Default Credentials do not exist. Run [gcloud auth application-default login] to configure them"
exit 1
if [[ $destination == *"gcr"* ]]; then
if [[ ! -e $HOME/.config/gcloud/application_default_credentials.json ]]; then
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

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}"

0 comments on commit 4919fb5

Please sign in to comment.