Skip to content

Commit

Permalink
login before pulling
Browse files Browse the repository at this point in the history
  • Loading branch information
jasongilanfarr committed Aug 11, 2016
1 parent 1ed0766 commit 9e8f37d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bin/build-base-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ TAGGED_IMAGE=$BASE_IMAGE_NAME:$BUILD_BASE_ID
# Check if we need to build the base image
if [[ "$(docker images -q $TAGGED_IMAGE 2>/dev/null)" -eq "" ]]; then
# try to pull, if that works, we're all set
if [[ "$DOCKER_HUB_USERNAME" -ne "" ]]; then
docker login -u "$DOCKER_HUB_USERNAME" -p "$DOCKER_HUB_PASSWORD" -e "$DOCKER_HUB_PASSWORD" >&2 || true
fi
if ! docker pull $TAGGED_IMAGE 2>/dev/null; then
docker build -t $TAGGED_IMAGE -f Dockerfile.build . >&2
if [[ "$DOCKER_HUB_USERNAME" -ne "" ]]; then
docker login -u "$DOCKER_HUB_USERNAME" -p "$DOCKER_HUB_PASSWORD" -e "$DOCKER_HUB_PASSWORD" >&2 || true
docker push $TAGGED_IMAGE >&2 || true
fi
docker push $TAGGED_IMAGE >&2 || true
fi
echo "Pulled $TAGGED_IMAGE" >&2
else
Expand Down

0 comments on commit 9e8f37d

Please sign in to comment.