2 الالتزامات

المؤلف SHA1 الرسالة التاريخ
zstadler
a4cbdd2e0d Update build.sh
Following review comments
2023-01-09 17:26:29 +02:00
zstadler
567658ba51 Build scripts refactoring
`.github/build-and-upload.sh` to use `build.sh`
Related to  #32
2023-01-09 13:59:00 +02:00
5 ملفات معدلة مع 23 إضافات و39 حذوفات

عرض الملف

@@ -1,14 +1,14 @@
FROM maven:3.9.5-eclipse-temurin-21 as build
FROM maven:3.6.3-jdk-8 as build
WORKDIR /graphhopper
COPY graphhopper .
RUN mvn clean install -DskipTests
RUN mvn clean install
FROM eclipse-temurin:21.0.1_12-jre
FROM openjdk:11.0-jre
ENV JAVA_OPTS "-Xmx1g -Xms1g"
ENV GH_URL ""
RUN mkdir -p /data
@@ -16,11 +16,10 @@ WORKDIR /graphhopper
COPY --from=build /graphhopper/web/target/graphhopper*.jar ./
COPY graphhopper.sh ./
COPY graphhopper.sh graphhopper/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
# Enable connections from outside of the container
RUN sed -i '/^ *bind_host/s/^ */&# /p' config-example.yml
VOLUME [ "/data" ]
@@ -28,4 +27,4 @@ EXPOSE 8989 8990
HEALTHCHECK --interval=5s --timeout=3s CMD curl --fail http://localhost:8989/health || exit 1
ENTRYPOINT [ "./graphhopper.sh" ]
ENTRYPOINT [ "./graphhopper.sh", "-c", "config-example.yml" ]

عرض الملف

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2024 Israel Hiking Map
Copyright (c) 2021 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 [`./build.sh`](./build.sh).
In order to build the docker image locally, please run [`.github/build.sh`](.github/build.sh).

عرض الملف

@@ -47,18 +47,11 @@ if [ "$1" ]; then
(cd graphhopper; git checkout --detach "$1")
fi
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
echo "Building docker image ${imagename}"
docker build . -t "${imagename}"
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}" .
if [ "${push}" == "false" ]; then
echo "Use \"docker push ${imagename}\" to publish the image on Docker Hub"
else
docker push "${imagename}"
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 StackOverfix answer http://stackoverflow.com/a/14607651
# See StackOverflow 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 Graphhopper server."
echo "$(basename $0): Start a Gpahhopper 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,18 +28,12 @@ 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 "-h | --help display this help message"
echo ""
echo "environment variables:"
echo "GH_URL download input file from this URL and save as data.pbf"
echo "--host <host> host address of the web server [default: 0.0.0.0]"
echo "-h | --help display this message"
}
# 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
@@ -48,7 +42,9 @@ 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"
@@ -65,11 +61,7 @@ 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
@@ -79,4 +71,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