message: Updating parametrized docker build arguments.
diff: # tagged image name with an argument, to push the image to a central repo
  # such as gcr.io or Docker Hub.
  #
  +# TF_DOCKER_BUILD_PUSH_WITH_CREDENTIALS
  +# (Optional)
  +# Do not set this along with TF_DOCKER_BUILD_PUSH_CMD. We will push with the
  +# direct commands as opposed to a script.
  +#
  +# TF_DOCKER_USERNAME
  +# (Optional)
  +# Dockerhub username for pushing a package.
  +#
  +# TF_DOCKER_EMAIL
  +# (Optional)
  +# Dockerhub email for pushing a package.
  +#
  +# TF_DOCKER_PASSWORD
  +# (Optional)
  +# Dockerhub password for pushing a package.
  +#
  # TF_DOCKER_BUILD_PYTHON_VERSION
  # (Optional)
  # Specifies the desired Python version. Defaults to PYTHON2.
  @@ -378,7 +395,6 @@ fi
  echo ""
  echo "Successfully tagged docker image: ${FINAL_IMG}"
  -
  # Optional: call command specified by TF_DOCKER_BUILD_PUSH_CMD to push image
  if [[ ! -z "${TF_DOCKER_BUILD_PUSH_CMD}" ]]; then
  ${TF_DOCKER_BUILD_PUSH_CMD} ${FINAL_IMG}
  @@ -388,3 +404,23 @@ if [[ ! -z "${TF_DOCKER_BUILD_PUSH_CMD}" ]]; then
  die "FAIL: Failed to push Docker image ${FINAL_IMG}"
  fi
  fi
  +
  +# Optional: set TF_DOCKER_BUILD_PUSH_WITH_CREDENTIALS to push image
  +if [[ ! -z "${TF_DOCKER_BUILD_PUSH_WITH_CREDENTIALS}" ]]; then
  +
  + docker login --username "${TF_DOCKER_USERNAME}" \
  + --email "${TF_DOCKER_EMAIL}" \
  + --password "${TF_DOCKER_PASSWORD}"
  +
  + if [[ $? != "0" ]]; then
  + die "FAIL: Unable to login. Invalid credentials."
  + fi
  + docker push $1
  + if [[ $? == "0" ]]; then
  + docker logout
  + echo "Successfully pushed Docker image ${FINAL_IMG}"
  + else
  + docker logout
  + die "FAIL: Failed to push Docker image ${FINAL_IMG}"
  + fi
  +fi
  