Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}"