From 57c848978c02c9c934456d418dc90fdceb91bb9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ma=CC=88der?= Date: Fri, 9 Jun 2017 12:41:14 +0200 Subject: [PATCH] Build script recognizes master=latest and develop=snapshot --- build.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/build.sh b/build.sh index 0bdb3ef..6309dca 100755 --- a/build.sh +++ b/build.sh @@ -28,14 +28,20 @@ DOCKER_REPO="${DOCKER_REPO-ninech}" BRANCH="${1}" URL="${URL-https://github.com/${SRC_REPO}/netbox/archive/$BRANCH.tar.gz}" -TAG="${TAG-latest}" +if [ "${BRANCH}" == "master" ]; then + TAG="${TAG-latest}" +elif [ "${BRANCH}" == "develop" ]; then + TAG="${TAG-snapshot}" +else + TAG="${TAG-$BRANCH}" +fi -echo "🐳 Building the Docker images for the branch '${BRANCH}'" -docker build -f Dockerfile -t "${DOCKER_REPO}/netbox:${BRANCH}" -t "${DOCKER_REPO}/netbox:${TAG}" --build-arg "BRANCH=${BRANCH}" --build-arg "URL=${URL}" . -echo "✅ Finished building the Docker images '${DOCKER_REPO}/netbox:${BRANCH}'" +echo "🐳 Building the Docker image '${DOCKER_REPO}/netbox:${TAG}' from the branch '${BRANCH}'." +docker build -f Dockerfile -t "${DOCKER_REPO}/netbox:${TAG}" --build-arg "BRANCH=${BRANCH}" --build-arg "URL=${URL}" --pull . +echo "✅ Finished building the Docker images '${DOCKER_REPO}/netbox:${TAG}'" if [ "${2}" == "--push" ] ; then - echo "⏫ Pushing 'netbox:${BRANCH}' and 'netbox:${BRANCH}-ldap'" - docker push "${DOCKER_REPO}/netbox:${BRANCH}" + echo "⏫ Pushing 'netbox:${BRANCH}" + docker push "${DOCKER_REPO}/netbox:${TAG}" echo "✅ Finished pushing the Docker images." fi