Skip to content

Commit 573d2ad

Browse files
author
Vladimir Kotal
committed
publish x.y docker tags
fixes #2842
1 parent f70822c commit 573d2ad

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

dev/docker.sh

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,24 @@ if [[ -z $DOCKER_PASSWORD ]]; then
3636
fi
3737

3838
VERSION="$TRAVIS_TAG"
39+
VERSION_SHORT=$( echo $VERSION | cut -d. -f1,2 )
40+
41+
if [[ -z $VERSION ]]; then
42+
echo "empty VERSION"
43+
exit 1
44+
fi
45+
46+
if [[ -z $VERSION_SHORT ]]; then
47+
echo "empty VERSION_SHORT"
48+
exit 1
49+
fi
3950

4051
# Build the image.
41-
docker build -t opengrok/docker:$VERSION -t opengrok/docker:latest .
52+
docker build \
53+
-t opengrok/docker:$VERSION \
54+
-t opengrok/docker:$VERSION_SHORT \
55+
-t opengrok/docker:latest .
56+
4257
#
4358
# Run the image in container. This is not strictly needed however
4459
# serves as additional test in automatic builds.
@@ -52,8 +67,8 @@ if [ -n "$DOCKER_PASSWORD" -a -n "$DOCKER_USERNAME" -a -n "$VERSION" ]; then
5267
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
5368

5469
# All the tags need to be pushed individually:
55-
echo "Pushing docker image for tag $VERSION"
56-
docker push opengrok/docker:$VERSION
57-
echo "Pushing docker image for tag latest"
58-
docker push opengrok/docker:latest
70+
for tag in $VERSION $VERSION_SHORT latest; do
71+
echo "Pushing docker image for tag $tag"
72+
docker push opengrok/docker:$tag
73+
done
5974
fi

0 commit comments

Comments
 (0)