Skip to content

Commit c0e5616

Browse files
author
Vladimir Kotal
committed
cleanup
1 parent 675e174 commit c0e5616

File tree

1 file changed

+10
-20
lines changed

1 file changed

+10
-20
lines changed

dev/docker.sh

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
# Uses the following Travis secure variables:
77
# - DOCKER_USERNAME
88
# - DOCKER_PASSWORD
9-
# - GITHUB_TOKEN
109
#
1110
# These are set via https://travis-ci.com/OpenGrok/docker/settings
1211
#
@@ -16,36 +15,27 @@ set -e
1615

1716
# Travis can only work on master since it needs encrypted variables.
1817
if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
18+
print "Not build docker image for pull requests"
1919
exit 0
2020
fi
2121

22-
JSON_OUT="ver.out"
23-
22+
# Build the image.
23+
docker build -t opengrok/docker:$VERSION -t opengrok/docker:latest .
2424
#
25-
# Get the latest OpenGrok version string. Use authenticated request to avoid
26-
# rate limiting induced errors.
25+
# Run the image in container. This is not strictly needed however
26+
# serves as additional test in automatic builds.
2727
#
28-
curl -sS -o "$JSON_OUT" \
29-
-H "Authorization: token $GITHUB_TOKEN" \
30-
https://api.github.com/repos/oracle/opengrok/releases/latest
31-
cat "$JSON_OUT"
32-
VERSION=`jq -er .tag_name ver.out`
33-
echo "Latest OpenGrok tag: $VERSION"
34-
35-
# Embed the tarball URL into the Dockerfile.
36-
tarball=`jq -er '.assets[]|select(.name|test("opengrok-.*tar.gz"))|.browser_download_url' "$JSON_OUT"`
37-
echo "Tarball URL: $tarball"
38-
sed "s%OPENGROK_DOWNLOAD_LINK%$tarball%" Dockerfile.tmpl > Dockerfile
39-
40-
# Build and run the image in container.
41-
docker build -t opengrok/docker:$VERSION -t opengrok/docker:latest .
4228
docker run -d opengrok/docker
4329
docker ps -a
4430

4531
# Publish the image to Docker hub.
4632
if [ -n "$DOCKER_PASSWORD" -a -n "$DOCKER_USERNAME" -a -n "$VERSION" ]; then
47-
echo "Pushing image for version $VERSION"
33+
echo "Logging into docker"
4834
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
35+
36+
# All the tags need to be pushed individually:
37+
echo "Pushing docker image for tag $VERSION"
4938
docker push opengrok/docker:$VERSION
39+
echo "Pushing docker image for tag latest"
5040
docker push opengrok/docker:latest
5141
fi

0 commit comments

Comments
 (0)