From 0bf85c8290ce6a3339a8444e685eadf22fed306d Mon Sep 17 00:00:00 2001 From: cyger Date: Thu, 21 Jan 2021 13:43:55 +0300 Subject: [PATCH] Add build hook for DockerHub --- hooks/build | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 hooks/build diff --git a/hooks/build b/hooks/build new file mode 100644 index 0000000..5c6bce2 --- /dev/null +++ b/hooks/build @@ -0,0 +1,16 @@ +#!/bin/bash + +TAG="${SOURCE_BRANCH:1}" +if [[ $TAG =~ ^[0-9]{1,4}\.[0-9]{1,4}\.[0-9]{1,4}\.[0-9]{1,4}$ ]]; then + TAG=${TAG%.*}-${TAG##*.} + if [ ${TAG:0:8} = "99.99.99" ]; then + URL_FOLDER="unstable" + else + URL_FOLDER="testing" + fi + URL="https://repo-doc-onlyoffice-com.s3-eu-west-1.amazonaws.com/onlyoffice/${URL_FOLDER}/ubuntu/${COMPANY_NAME}-${PRODUCT_NAME}_${TAG}_amd64.deb" + docker build --build-arg PACKAGE_URL=$URL -f $DOCKERFILE_PATH -t $IMAGE_NAME . +else + echo Tag is not correct, Image will be built with default URL. + docker build -f $DOCKERFILE_PATH -t $IMAGE_NAME . +fi