Makefile: Targets for the lite image for other flavors will no longer build the base image automatically.

I already made this change for the default image in https://github.com/youtube/vitess/pull/2768.

Additionally, I've tweaked the build script for the lite image to always show the correct flavor in the warning and error messages.
This commit is contained in:
Michael Berlin 2017-04-14 14:53:02 -07:00
Родитель e69bc106ea
Коммит 6eeebaca36
2 изменённых файлов: 18 добавлений и 19 удалений

Просмотреть файл

@ -194,17 +194,17 @@ docker_base_percona57:
docker_lite:
cd docker/lite && ./build.sh --prompt=$(PROMPT_NOTICE)
docker_lite_mysql56: docker_base_mysql56
cd docker/lite && ./build.sh mysql56
docker_lite_mysql56:
cd docker/lite && ./build.sh --prompt=$(PROMPT_NOTICE) mysql56
docker_lite_mariadb: docker_base_mariadb
cd docker/lite && ./build.sh mariadb
docker_lite_mariadb:
cd docker/lite && ./build.sh --prompt=$(PROMPT_NOTICE) mariadb
docker_lite_percona: docker_base_percona
cd docker/lite && ./build.sh percona
docker_lite_percona:
cd docker/lite && ./build.sh --prompt=$(PROMPT_NOTICE) percona
docker_lite_percona57: docker_base_percona57
cd docker/lite && ./build.sh percona57
docker_lite_percona57:
cd docker/lite && ./build.sh --prompt=$(PROMPT_NOTICE) percona57
docker_guestbook:
cd examples/kubernetes/guestbook && ./build.sh

Просмотреть файл

@ -14,20 +14,24 @@ fi
flavor=$1
base_image=vitess/base
make_target=docker_base
lite_image=vitess/lite
dockerfile=Dockerfile
tag=latest
if [[ -n "$flavor" ]]; then
base_image=vitess/base:$flavor
make_target=docker_base_$flavor
lite_image=vitess/lite:$flavor
dockerfile=Dockerfile.$flavor
tag=$flavor
else
echo "Flavor not specified as first argument. Building default image."
base_image=vitess/base
lite_image=vitess/lite
fi
# Abort if base image does not exist.
if ! docker inspect $base_image &>/dev/null; then
echo "ERROR: Dependent image $base_image does not exist. Run 'make docker_base' to build it locally or 'docker pull $base_image' to fetch it from Docker Hub."
echo "ERROR: Dependent image $base_image does not exist. Run 'make $make_target' to build it locally or 'docker pull $base_image' to fetch it from Docker Hub (if it is published)."
exit 1
fi
@ -43,10 +47,10 @@ The 'docker images' output below shows you how old your local base image is:
$(docker images vitess/base | grep -E "(CREATED|$tag)")
If you need a newer base image, you will have to manually run 'make docker_base' to build it locally
If you need a newer base image, you will have to manually run 'make $make_target' to build it locally
or 'docker pull $base_image' to fetch it from Docker Hub.
Press ENTER to continue building 'vitess/lite' or Ctrl-C to cancel.
Press ENTER to continue building '$lite_image' or Ctrl-C to cancel.
END
read
fi
@ -80,12 +84,7 @@ rm -rf base
chmod -R o=g lite
# Build vitess/lite image
if [[ -n "$flavor" ]]; then
docker build --no-cache -f Dockerfile.$flavor -t vitess/lite:$flavor .
else
docker build --no-cache -t vitess/lite .
fi
docker build --no-cache -f $dockerfile -t $lite_image .
# Clean up temporary files
rm -rf lite