Compare commits
14 الالتزامات
permission
...
main
| المؤلف | SHA1 | التاريخ | |
|---|---|---|---|
| ba873648e5 | |||
| b139bd9605 | |||
| 9dc84fce5d | |||
| e43fa37b15 | |||
|
|
ed0f3aea11 | ||
|
|
735390c9c2 | ||
|
|
7be2d9d406 | ||
|
|
74f23a3dd4 | ||
|
|
92d4cba7a9 | ||
|
|
74f8f822bd | ||
|
|
2d0bed8a91 | ||
|
|
5897045b9e | ||
|
|
f06f2beb48 | ||
|
|
7b50d771d5 |
22
.github/build-and-upload.sh
مباع
Normal file → Executable file
22
.github/build-and-upload.sh
مباع
Normal file → Executable file
@@ -1,20 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
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
|
||||
echo "Buidling and pushing israelhikingmap/graphhopper:latest"
|
||||
./build.sh --push
|
||||
|
||||
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";
|
||||
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}";
|
||||
else
|
||||
(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
|
||||
echo "Buidling and pushing israelhikingmap/graphhopper:${TAG}"
|
||||
./build.sh --push "${TAG}"
|
||||
fi
|
||||
|
||||
17
Dockerfile
17
Dockerfile
@@ -1,14 +1,14 @@
|
||||
FROM maven:3.6.3-jdk-8 as build
|
||||
FROM maven:3.9.5-eclipse-temurin-21 as build
|
||||
|
||||
WORKDIR /graphhopper
|
||||
|
||||
COPY graphhopper .
|
||||
|
||||
RUN mvn clean install
|
||||
RUN mvn clean install -DskipTests
|
||||
|
||||
FROM openjdk:11.0-jre
|
||||
FROM eclipse-temurin:21.0.1_12-jre
|
||||
|
||||
ENV JAVA_OPTS "-Xmx1g -Xms1g"
|
||||
ENV GH_URL ""
|
||||
|
||||
RUN mkdir -p /data
|
||||
|
||||
@@ -16,10 +16,11 @@ WORKDIR /graphhopper
|
||||
|
||||
COPY --from=build /graphhopper/web/target/graphhopper*.jar ./
|
||||
|
||||
COPY graphhopper.sh graphhopper/config-example.yml ./
|
||||
COPY graphhopper.sh ./
|
||||
|
||||
# Enable connections from outside of the container
|
||||
RUN sed -i '/^ *bind_host/s/^ */&# /p' config-example.yml
|
||||
# Remove the previous sed command since we're hardcoding in the script
|
||||
# Enable connections from outside of the container by hardcoding 0.0.0.0 in config
|
||||
RUN sed -i 's/^\( *bind_host:\).*/\1 0.0.0.0/' config-example.yml
|
||||
|
||||
VOLUME [ "/data" ]
|
||||
|
||||
@@ -27,4 +28,4 @@ EXPOSE 8989 8990
|
||||
|
||||
HEALTHCHECK --interval=5s --timeout=3s CMD curl --fail http://localhost:8989/health || exit 1
|
||||
|
||||
ENTRYPOINT [ "./graphhopper.sh", "-c", "config-example.yml" ]
|
||||
ENTRYPOINT [ "./graphhopper.sh" ]
|
||||
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 Israel Hiking Map
|
||||
Copyright (c) 2024 Israel Hiking Map
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -33,4 +33,4 @@ docker run --entrypoint /bin/bash israelhikingmap/graphhopper -c "wget https://d
|
||||
|
||||
Checkout `graphhopper.sh` for more usage options such as import.
|
||||
|
||||
In order to build the docker image locally, please run [`.github/build.sh`](.github/build.sh).
|
||||
In order to build the docker image locally, please run [`./build.sh`](./build.sh).
|
||||
|
||||
39
build.sh
39
build.sh
@@ -2,19 +2,32 @@
|
||||
|
||||
usage() (
|
||||
cat <<USAGE
|
||||
Build a docker image
|
||||
Build a docker image for GraphHopper and optionally push it to Docker Hub
|
||||
|
||||
Usage:
|
||||
./build.sh [<tag> | --help]
|
||||
./build.sh [[--push] <tag>]
|
||||
./build.sh --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:
|
||||
--help Print this message
|
||||
--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.
|
||||
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
|
||||
@@ -23,6 +36,9 @@ 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}"
|
||||
@@ -31,9 +47,18 @@ if [ "$1" ]; then
|
||||
(cd graphhopper; git checkout --detach "$1")
|
||||
fi
|
||||
|
||||
echo "Building docker image ${imagename}"
|
||||
docker build . -t ${imagename}
|
||||
echo "Creating new builder instance for multi-platform (linux/amd64, linux/arm64/v8) builds to use for building Graphhopper"
|
||||
docker buildx create --use --name graphhopperbuilder
|
||||
|
||||
if [ $# -eq 1 ]; then
|
||||
|
||||
if [ "${push}" == "true" ]; then
|
||||
echo "Building docker image ${imagename} for linux/amd64 and linux/arm64/v8 and pushing to Docker Hub\n"
|
||||
docker buildx build --platform linux/amd64,linux/arm64/v8 -t "${imagename}" --push .
|
||||
else
|
||||
echo "Building docker image ${imagename} for linux/amd64 and linux/arm64/v8\n"
|
||||
docker buildx build --platform linux/amd64,linux/arm64/v8 -t "${imagename}" .
|
||||
echo "Use \"docker push ${imagename}\" to publish the image on Docker Hub"
|
||||
fi
|
||||
|
||||
# Remove the builder instance after use
|
||||
docker buildx rm graphhopperbuilder
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
(set -o igncr) 2>/dev/null && set -o igncr; # this comment is required for handling Windows cr/lf
|
||||
# See StackOverflow answer http://stackoverflow.com/a/14607651
|
||||
# See StackOverfix answer http://stackoverflow.com/a/14607651
|
||||
|
||||
GH_HOME=$(dirname "$0")
|
||||
JAVA=$JAVA_HOME/bin/java
|
||||
@@ -16,7 +16,7 @@ fi
|
||||
echo "## using java $vers from $JAVA_HOME"
|
||||
|
||||
function printBashUsage {
|
||||
echo "$(basename $0): Start a Gpahhopper server."
|
||||
echo "$(basename $0): Start a Graphhopper server."
|
||||
echo "Default user access at 0.0.0.0:8989 and API access at 0.0.0.0:8989/route"
|
||||
echo ""
|
||||
echo "Usage"
|
||||
@@ -28,12 +28,18 @@ function printBashUsage {
|
||||
echo "--import only create the graph cache, to be used later for faster starts"
|
||||
echo "-c | --config <config> application configuration file location"
|
||||
echo "-o | --graph-cache <dir> directory for graph cache output"
|
||||
echo "-p | --profiles <string> comma separated list of vehicle profiles"
|
||||
echo "--port <port> port for web server [default: 8989]"
|
||||
echo "--host <host> host address of the web server [default: 0.0.0.0]"
|
||||
echo "-h | --help display this message"
|
||||
echo "-h | --help display this help message"
|
||||
echo ""
|
||||
echo "environment variables:"
|
||||
echo "GH_URL download input file from this URL and save as data.pbf"
|
||||
}
|
||||
|
||||
# Check for environment variable first
|
||||
if [ -z "$URL" ] && [ ! -z "$GH_URL" ]; then
|
||||
URL="$GH_URL"
|
||||
fi
|
||||
|
||||
# one character parameters have one minus character'-'. longer parameters have two minus characters '--'
|
||||
while [ ! -z $1 ]; do
|
||||
case $1 in
|
||||
@@ -42,9 +48,7 @@ while [ ! -z $1 ]; do
|
||||
-i|--input) FILE="$2"; shift 2;;
|
||||
--url) URL="$2"; shift 2;;
|
||||
-o|--graph-cache) GRAPH="$2"; shift 2;;
|
||||
-p|--profiles) GH_WEB_OPTS="$GH_WEB_OPTS -Ddw.graphhopper.graph.flag_encoders=$2"; shift 2;;
|
||||
--port) GH_WEB_OPTS="$GH_WEB_OPTS -Ddw.server.application_connectors[0].port=$2"; shift 2;;
|
||||
--host) GH_WEB_OPTS="$GH_WEB_OPTS -Ddw.server.application_connectors[0].bind_host=$2"; shift 2;;
|
||||
-h|--help) printBashUsage
|
||||
exit 0;;
|
||||
-*) echo "Option unknown: $1"
|
||||
@@ -61,7 +65,11 @@ done
|
||||
: "${JAVA_OPTS:=-Xmx1g -Xms1g}"
|
||||
: "${JAR:=$(find . -type f -name "*.jar")}"
|
||||
|
||||
# Hardcoded host to 0.0.0.0
|
||||
GH_WEB_OPTS="$GH_WEB_OPTS -Ddw.server.application_connectors[0].bind_host=0.0.0.0"
|
||||
|
||||
if [ "$URL" != "" ]; then
|
||||
echo "## Downloading OSM data from: $URL"
|
||||
wget -S -nv -O "${FILE:=data.pbf}" "$URL"
|
||||
fi
|
||||
|
||||
@@ -71,4 +79,4 @@ mkdir -p $(dirname "${GRAPH}")
|
||||
echo "## Executing $ACTION. JAVA_OPTS=$JAVA_OPTS"
|
||||
|
||||
exec "$JAVA" $JAVA_OPTS ${FILE:+-Ddw.graphhopper.datareader.file="$FILE"} -Ddw.graphhopper.graph.location="$GRAPH" \
|
||||
$GH_WEB_OPTS -jar "$JAR" $ACTION $CONFIG
|
||||
$GH_WEB_OPTS -jar "$JAR" $ACTION $CONFIG
|
||||
المرجع في مشكلة جديدة
حظر مستخدم