1 الالتزامات

المؤلف SHA1 الرسالة التاريخ
zstadler
cdcbe32dd1 Add missing execute permissions for .sh files
Resolve #28
2022-12-29 22:13:15 +02:00
2 ملفات معدلة مع 21 إضافات و31 حذوفات

22
.github/build-and-upload.sh مباع Executable file → Normal file
عرض الملف

@@ -1,12 +1,20 @@
#!/bin/bash
echo "Buidling and pushing israelhikingmap/graphhopper:latest"
./build.sh --push
echo "Cloning graphhopper"
git clone https://github.com/graphhopper/graphhopper.git
echo "Building docker image"
docker build . -t israelhikingmap/graphhopper:latest
docker login --username $DOCKERHUB_USER --password $DOCKERHUB_TOKEN
echo "Publishing docker image"
docker push israelhikingmap/graphhopper:latest
TAG=`cd graphhopper; git for-each-ref --sort=committerdate refs/tags | sed -n '$s/.*\///p'`
if docker manifest inspect "israelhikingmap/graphhopper:${TAG}" >/dev/null; then
echo "No need to push existing version: ${TAG}";
TAG=`cd graphhopper; git for-each-ref --sort=committerdate refs/tags | tail -n 1 | cut -d "/" -f3`
if docker manifest inspect israelhikingmap/graphhopper:$TAG >/dev/null; then
echo "No need to publish existing version: $TAG";
else
echo "Buidling and pushing israelhikingmap/graphhopper:${TAG}"
./build.sh --push "${TAG}"
(cd graphhopper ; git checkout tags/$TAG)
echo "Building docker image for tag: $TAG"
docker build . -t israelhikingmap/graphhopper:$TAG
echo "Publishing docker image for tag: $TAG"
docker push israelhikingmap/graphhopper:$TAG
fi

عرض الملف

@@ -2,32 +2,19 @@
usage() (
cat <<USAGE
Build a docker image for GraphHopper and optionally push it to Docker Hub
Build a docker image
Usage:
./build.sh [[--push] <tag>]
./build.sh --help
./build.sh [<tag> | --help]
Argument:
<tag> Build an image for the given graphhopper repository tag [default: master]
<tag> Build an image for the given graphhopper repository tag [default: master]
Option:
--push Push the image to Docker Hub
--help Print this message
Docker Hub credentials are needed for pushing the image. If they are not provided using the
DOCKERHUB_USER and DOCKERHUB_TOKEN environment variables, then they will be asked interactively.
--help Print this message
USAGE
)
if [ "$1" == "--push" ]; then
push="true"
docker login --username "${DOCKERHUB_USER}" --password "${DOCKERHUB_TOKEN}" || exit $?
shift
else
push="false"
fi
if [ $# -gt 1 ] || [ "$1" == "--help" ]; then
usage
exit
@@ -36,9 +23,6 @@ fi
if [ ! -d graphhopper ]; then
echo "Cloning graphhopper"
git clone https://github.com/graphhopper/graphhopper.git
else
echo "Pulling graphhopper"
(cd graphhopper; git checkout master; git pull)
fi
imagename="israelhikingmap/graphhopper:${1:-latest}"
@@ -48,10 +32,8 @@ if [ "$1" ]; then
fi
echo "Building docker image ${imagename}"
docker build . -t "${imagename}"
docker build . -t ${imagename}
if [ "${push}" == "false" ]; then
if [ $# -eq 1 ]; then
echo "Use \"docker push ${imagename}\" to publish the image on Docker Hub"
else
docker push "${imagename}"
fi