Skip to content

Commit

Permalink
Make the run_in_docker script support caching. (#564)
Browse files Browse the repository at this point in the history
  • Loading branch information
dlorenc authored Feb 19, 2019
1 parent e8564f0 commit 7c3947b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions run_in_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,19 @@
#!/bin/bash
set -e

if [ $# -ne 3 ];
then echo "Usage: run_in_docker.sh <path to Dockerfile> <context directory> <image tag>"
exit 1
if [ $# -lt 3 ];
then echo "Usage: run_in_docker.sh <path to Dockerfile> <context directory> <image tag> <cache>"
fi

dockerfile=$1
context=$2
destination=$3

cache="false"
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
Expand All @@ -33,4 +37,6 @@ 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/
--dockerfile ${dockerfile} --destination ${destination} --context dir:///workspace/ \
--cache=${cache}

0 comments on commit 7c3947b

Please sign in to comment.