run_tests.py: support downloading base image from dockerhub

pull/9859/head
Jan Tattermusch 8 years ago
parent 13c1562934
commit b10a193b16
  1. 7
      tools/run_tests/dockerize/build_docker_and_run_tests.sh

@ -47,12 +47,19 @@ mkdir -p /tmp/xdg-cache-home
# Inputs # Inputs
# DOCKERFILE_DIR - Directory in which Dockerfile file is located. # DOCKERFILE_DIR - Directory in which Dockerfile file is located.
# DOCKER_RUN_SCRIPT - Script to run under docker (relative to grpc repo root) # DOCKER_RUN_SCRIPT - Script to run under docker (relative to grpc repo root)
# DOCKERHUB_ORGANIZATION - If set, pull a prebuilt image from given dockerhub org.
# Use image name based on Dockerfile location checksum # Use image name based on Dockerfile location checksum
DOCKER_IMAGE_NAME=$(basename $DOCKERFILE_DIR)_$(sha1sum $DOCKERFILE_DIR/Dockerfile | cut -f1 -d\ ) DOCKER_IMAGE_NAME=$(basename $DOCKERFILE_DIR)_$(sha1sum $DOCKERFILE_DIR/Dockerfile | cut -f1 -d\ )
if [ "$DOCKERHUB_ORGANIZATION" != "" ]
then
DOCKER_IMAGE_NAME=$DOCKERHUB_ORGANIZATION/$DOCKER_IMAGE_NAME
docker pull $DOCKER_IMAGE_NAME
else
# Make sure docker image has been built. Should be instantaneous if so. # Make sure docker image has been built. Should be instantaneous if so.
docker build -t $DOCKER_IMAGE_NAME $DOCKERFILE_DIR docker build -t $DOCKER_IMAGE_NAME $DOCKERFILE_DIR
fi
# Choose random name for docker container # Choose random name for docker container
CONTAINER_NAME="run_tests_$(uuidgen)" CONTAINER_NAME="run_tests_$(uuidgen)"

Loading…
Cancel
Save