From 24a1b130f9ff32704c5b2d8d508db70123ce60a0 Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Mon, 26 Jun 2017 10:58:19 +0400 Subject: [PATCH] [docker] build and push scripts [ci skip] --- DOCKER/Makefile | 8 ++------ DOCKER/build.sh | 20 ++++++++++++++++++++ DOCKER/push.sh | 22 ++++++++++++++++++++++ 3 files changed, 44 insertions(+), 6 deletions(-) create mode 100755 DOCKER/build.sh create mode 100755 DOCKER/push.sh diff --git a/DOCKER/Makefile b/DOCKER/Makefile index 612b9a694..10c972502 100644 --- a/DOCKER/Makefile +++ b/DOCKER/Makefile @@ -1,12 +1,8 @@ build: - # TAG=0.8.0 TAG_NO_PATCH=0.8 - docker build -t "tendermint/tendermint" -t "tendermint/tendermint:$(TAG)" -t "tendermint/tendermint:$(TAG_NO_PATCH)" . + @sh -c "'$(CURDIR)/build.sh'" push: - # TAG=0.8.0 TAG_NO_PATCH=0.8 - docker push "tendermint/tendermint:latest" - docker push "tendermint/tendermint:$(TAG)" - docker push "tendermint/tendermint:$(TAG_NO_PATCH)" + @sh -c "'$(CURDIR)/push.sh'" build_develop: docker build -t "tendermint/tendermint:develop" -f Dockerfile.develop . diff --git a/DOCKER/build.sh b/DOCKER/build.sh new file mode 100755 index 000000000..ee617cc63 --- /dev/null +++ b/DOCKER/build.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +set -e + +# Get the tag from the version, or try to figure it out. +if [ -z "$TAG" ]; then + TAG=$(awk -F\" '/Version =/ { print $2; exit }' < ../version/version.go) +fi +if [ -z "$TAG" ]; then + echo "Please specify a tag." + exit 1 +fi + +TAG_NO_PATCH=${TAG%.*} + +read -p "==> Build 3 docker images with the following tags (latest, $TAG, $TAG_NO_PATCH)? y/n" -n 1 -r +echo +if [[ $REPLY =~ ^[Yy]$ ]] +then + docker build -t "tendermint/tendermint" -t "tendermint/tendermint:$TAG" -t "tendermint/tendermint:$TAG_NO_PATCH" . +fi diff --git a/DOCKER/push.sh b/DOCKER/push.sh new file mode 100755 index 000000000..32741dce8 --- /dev/null +++ b/DOCKER/push.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +set -e + +# Get the tag from the version, or try to figure it out. +if [ -z "$TAG" ]; then + TAG=$(awk -F\" '/Version =/ { print $2; exit }' < ../version/version.go) +fi +if [ -z "$TAG" ]; then + echo "Please specify a tag." + exit 1 +fi + +TAG_NO_PATCH=${TAG%.*} + +read -p "==> Push 3 docker images with the following tags (latest, $TAG, $TAG_NO_PATCH)? y/n" -n 1 -r +echo +if [[ $REPLY =~ ^[Yy]$ ]] +then + docker push "tendermint/tendermint:latest" + docker push "tendermint/tendermint:$TAG" + docker push "tendermint/tendermint:$TAG_NO_PATCH" +fi