From 32cd27ebeef6c4713116f3c4a21566b2cbaeee82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Tue, 3 Oct 2017 10:31:05 +0200 Subject: [PATCH] only use image tag when ZAMMAD_VERSION var is set --- hooks/build | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hooks/build b/hooks/build index 06a6813..6c7209f 100755 --- a/hooks/build +++ b/hooks/build @@ -9,9 +9,14 @@ set -ex for DOCKER_IMAGE in ${DOCKER_IMAGES}; do if [ "${TRAVIS}" == 'true' ]; then + + if [ -n "${ZAMMAD_VERSION}" ]; then + DOCKER_TAG="-t ${DOCKER_REGISTRY}/${GITHUB_USERNAME}/${DOCKER_REPOSITORY}:${DOCKER_IMAGE}-${ZAMMAD_VERSION}" + fi + echo "Build Zammad Docker image ${DOCKER_IMAGE} with version ${ZAMMAD_VERSION} for DockerHubs ${DOCKER_REGISTRY}/${GITHUB_USERNAME}/${DOCKER_REPOSITORY}:${DOCKER_IMAGE} repo" - docker build --pull --no-cache --build-arg BUILD_DATE=$(date -u +”%Y-%m-%dT%H:%M:%SZ”) -t ${DOCKER_REGISTRY}/${GITHUB_USERNAME}/${DOCKER_REPOSITORY}:${DOCKER_IMAGE} -t ${DOCKER_REGISTRY}/${GITHUB_USERNAME}/${DOCKER_REPOSITORY}:${DOCKER_IMAGE}-${ZAMMAD_VERSION} -f containers/${DOCKER_IMAGE}/Dockerfile . + docker build --pull --no-cache --build-arg BUILD_DATE=$(date -u +”%Y-%m-%dT%H:%M:%SZ”) -t ${DOCKER_REGISTRY}/${GITHUB_USERNAME}/${DOCKER_REPOSITORY}:${DOCKER_IMAGE} ${DOCKER_TAG} -f containers/${DOCKER_IMAGE}/Dockerfile . docker push ${DOCKER_REGISTRY}/${GITHUB_USERNAME}/${DOCKER_REPOSITORY}:${DOCKER_IMAGE}