X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=travis%2Fdocker-build-and-push.sh;h=9b654a84703f5d2ad580d39d1620b3e76468e9e4;hb=12c073e2ee62289d73ff54d0dbab4245695ce416;hp=7dfd3392b346604e02dfd43702cc3d369f2c8a1b;hpb=fbfbdb8e124480bc90bbd6a8b59c1692c4ebd531;p=i3%2Fi3 diff --git a/travis/docker-build-and-push.sh b/travis/docker-build-and-push.sh index 7dfd3392..9b654a84 100755 --- a/travis/docker-build-and-push.sh +++ b/travis/docker-build-and-push.sh @@ -2,10 +2,19 @@ set -e +BASENAME=$1 +DOCKERFILE=$2 + # .dockerignore is created on demand so that release.sh and other scripts are # not influenced by our travis setup. echo .git > .dockerignore -docker build --pull --no-cache --rm -t=${BASENAME} -f travis-build.Dockerfile . -docker login -e ${DOCKER_EMAIL} -u ${DOCKER_USER} -p ${DOCKER_PASS} -docker push ${BASENAME} +docker build --pull --no-cache --rm -t=${BASENAME} -f ${DOCKERFILE} . +# For pull requests, travis does not add secure environment variables to the +# environment (because pull requests could then steal their values), so skip +# the login+push step when the variable isn’t set. +if [ -n "${DOCKER_PASS}" ] +then + docker login -e ${DOCKER_EMAIL} -u ${DOCKER_USER} -p ${DOCKER_PASS} + docker push ${BASENAME} +fi