Last active
February 12, 2019 14:34
-
-
Save remorses/0275e81a4fa33bc851116460a8cb1ef0 to your computer and use it in GitHub Desktop.
Docker deploy with version tag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -ex | |
################################################## | |
REGISTRY="myregistry.com:5000" # for docker hub just put your username | |
IMAGE=`basename $PWD` # image name | |
################################################## | |
test -f ./VERSION || echo "file VERSION containing current version is needed" && exit 1 | |
test -f ./build.sh || echo "file build.sh containing build script is needed" && exit 1 | |
git pull | |
# bump version | |
docker run --rm -v "$PWD":/app treeder/bump patch | |
version=`cat VERSION` | |
echo "version: $version" | |
# run build | |
./build.sh | |
# tag it | |
git add -A | |
git commit -m "version $version" | |
git tag -a "$version" -m "version $version" | |
git push | |
git push --tags | |
docker tag $REGISTRY/$IMAGE:latest $REGISTRY/$IMAGE:$version | |
# push it | |
docker push $REGISTRY/$IMAGE:latest | |
docker push $REGISTRY/$IMAGE:$version |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment