Build script recognizes master=latest and develop=snapshot

This commit is contained in:
Christian Mäder 2017-06-09 12:41:14 +02:00
parent d9c1bd143d
commit 57c848978c
No known key found for this signature in database
GPG Key ID: 92FFD0A711F196BB
1 changed files with 12 additions and 6 deletions

View File

@ -28,14 +28,20 @@ DOCKER_REPO="${DOCKER_REPO-ninech}"
BRANCH="${1}" BRANCH="${1}"
URL="${URL-https://github.com/${SRC_REPO}/netbox/archive/$BRANCH.tar.gz}" 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}'" echo "🐳 Building the Docker image '${DOCKER_REPO}/netbox:${TAG}' from 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}" . 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:${BRANCH}'" echo "✅ Finished building the Docker images '${DOCKER_REPO}/netbox:${TAG}'"
if [ "${2}" == "--push" ] ; then if [ "${2}" == "--push" ] ; then
echo "⏫ Pushing 'netbox:${BRANCH}' and 'netbox:${BRANCH}-ldap'" echo "⏫ Pushing 'netbox:${BRANCH}"
docker push "${DOCKER_REPO}/netbox:${BRANCH}" docker push "${DOCKER_REPO}/netbox:${TAG}"
echo "✅ Finished pushing the Docker images." echo "✅ Finished pushing the Docker images."
fi fi