File tree Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -36,9 +36,24 @@ if [[ -z $DOCKER_PASSWORD ]]; then
36
36
fi
37
37
38
38
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
39
50
40
51
# 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
+
42
57
#
43
58
# Run the image in container. This is not strictly needed however
44
59
# serves as additional test in automatic builds.
@@ -52,8 +67,8 @@ if [ -n "$DOCKER_PASSWORD" -a -n "$DOCKER_USERNAME" -a -n "$VERSION" ]; then
52
67
echo " $DOCKER_PASSWORD " | docker login -u " $DOCKER_USERNAME " --password-stdin
53
68
54
69
# 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
59
74
fi
You can’t perform that action at this time.
0 commit comments