forked from IsraelHikingMap/graphhopper-docker-image-push
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
39 lines (30 loc) · 758 Bytes
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
usage() (
cat <<USAGE
Build a docker image
Usage:
./build.sh [<tag> | --help]
Argument:
<tag> Build an image for the given graphhopper repository tag [default: master]
Option:
--help Print this message
USAGE
)
if [ $# -gt 1 ] || [ "$1" == "--help" ]; then
usage
exit
fi
if [ ! -d graphhopper ]; then
echo "Cloning graphhopper"
git clone https://github.com/graphhopper/graphhopper.git
fi
imagename="israelhikingmap/graphhopper:${1:-latest}"
if [ "$1" ]; then
echo "Checking out graphhopper:$1"
(cd graphhopper; git checkout --detach "$1")
fi
echo "Building docker image ${imagename}"
docker build . -t ${imagename}
if [ $# -eq 1 ]; then
echo "Use \"docker push ${imagename}\" to publish the image on Docker Hub"
fi