Make the run_in_docker script support caching. (#564)
This commit is contained in:
parent
e8564f0d28
commit
7c3947b08d
|
|
@ -15,15 +15,19 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ $# -ne 3 ];
|
if [ $# -lt 3 ];
|
||||||
then echo "Usage: run_in_docker.sh <path to Dockerfile> <context directory> <image tag>"
|
then echo "Usage: run_in_docker.sh <path to Dockerfile> <context directory> <image tag> <cache>"
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dockerfile=$1
|
dockerfile=$1
|
||||||
context=$2
|
context=$2
|
||||||
destination=$3
|
destination=$3
|
||||||
|
|
||||||
|
cache="false"
|
||||||
|
if [[ ! -z "$4" ]]; then
|
||||||
|
cache=$4
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ ! -e $HOME/.config/gcloud/application_default_credentials.json ]]; 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"
|
echo "Application Default Credentials do not exist. Run [gcloud auth application-default login] to configure them"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
@ -33,4 +37,6 @@ docker run \
|
||||||
-v $HOME/.config/gcloud:/root/.config/gcloud \
|
-v $HOME/.config/gcloud:/root/.config/gcloud \
|
||||||
-v ${context}:/workspace \
|
-v ${context}:/workspace \
|
||||||
gcr.io/kaniko-project/executor:latest \
|
gcr.io/kaniko-project/executor:latest \
|
||||||
--dockerfile ${dockerfile} --destination ${destination} --context dir:///workspace/
|
--dockerfile ${dockerfile} --destination ${destination} --context dir:///workspace/ \
|
||||||
|
--cache=${cache}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue