From 54e278f3febe7b13e010262ebcabad23347e3f42 Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Mon, 22 Jan 2024 17:17:07 +0100 Subject: [PATCH] Build graph before building container --- .github/workflows/main.yml | 9 ++++- build-config.json | 8 ++-- build-graph.sh | 4 +- infrastructure/docker/otp/Dockerfile | 56 +++------------------------- 4 files changed, 19 insertions(+), 58 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 72aba02b..9756d203 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,13 +21,18 @@ env: jobs: test: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v2 - name: REUSE Compliance Check uses: fsfe/reuse-action@v1 - + + - name: Build graph + run: | + apt install osmium-tool wget + ./build-graph + - name: Build docker file uses: noi-techpark/github-actions/docker-build@v2 with: diff --git a/build-config.json b/build-config.json index fec2840c..5aeea626 100644 --- a/build-config.json +++ b/build-config.json @@ -6,12 +6,14 @@ "source": "https://gtfs.api.opendatahub.com/v1/dataset/sta-time-tables/raw", "type": "gtfs", "feedId": "sta" - }, - { + } + /* + this feed is not GTFS-compliant yet: https://github.com/noi-techpark/odh-mentor-otp/issues/168#issuecomment-1904328702 + ,{ "source": "https://gtfs.api.opendatahub.com/v1/dataset/skyalps-flight-data/raw", "type": "gtfs", "feedId": "skyalps" - } + }*/ ], "osm": [ { diff --git a/build-graph.sh b/build-graph.sh index 99abd8dc..587bfaf5 100755 --- a/build-graph.sh +++ b/build-graph.sh @@ -14,8 +14,8 @@ OTP_IMAGE=docker.io/opentripplanner/opentripplanner:2.5.0_2024-01-19T14-50 wget https://download.geofabrik.de/europe/italy/nord-est-latest.osm.pbf -O ${NORTH_EASTH_PBF} --no-clobber osmium extract ${NORTH_EASTH_PBF} --polygon south-tyrol.geojson -o ${SOUTH_TYROL_PBF} --overwrite -podman run \ +docker run \ -v .:/var/opentripplanner/:z \ --rm \ - -e JAVA_TOOL_OPTIONS="Xmx16G" \ + -e JAVA_TOOL_OPTIONS="-Xmx6G" \ ${OTP_IMAGE} --build --save diff --git a/infrastructure/docker/otp/Dockerfile b/infrastructure/docker/otp/Dockerfile index 362de8da..861b803a 100644 --- a/infrastructure/docker/otp/Dockerfile +++ b/infrastructure/docker/otp/Dockerfile @@ -1,54 +1,8 @@ -FROM node:16.14.0-alpine3.14 +FROM docker.io/opentripplanner/opentripplanner:2.5.0_2024-01-19T14-50 -ARG OTP_VERSION=1.5.2 -ARG GTFS_URL_UPDATETIME="0 2 * * *" +WORKDIR /var/otp -ENV JAVA_MX=4G \ - GBFS_VERSION=1 \ - GTFS_URL=ftp://ftp.sta.bz.it/gtfs/google_transit_shp.zip \ - GTFS_URL_UPDATETIME=$GTFS_URL_UPDATETIME \ - GTFS_URL_UPDATEHOOK='' +ADD router-config.json /var/otp/ +ADD graph.obj /var/otp/ -RUN apk add --no-cache \ - openjdk8-jre \ - unzip \ - bash \ - curl \ - gdal-tools - -RUN mkdir -p /usr/local/share/java -RUN mkdir -p /var/otp -RUN mkdir -p /conf - -# OpenTripPlanner Openmove fork https://github.com/openmove/OpenTripPlanner - -#RUN curl -o /usr/local/share/java/otp.jar https://repo1.maven.org/maven2/org/opentripplanner/otp/$OTP_VERSION/otp-$OTP_VERSION-shaded.jar -#COPY otp-1.5.0-clusters-extended.jar /usr/local/share/java/otp-unofficial.jar - -#RUN curl -Lo otp-unofficial.jar "https://github.com/openmove/OpenTripPlanner/releases/download/v${OTP_VERSION}/otp-${OTP_VERSION}-SNAPSHOT-shaded.jar" -#COPY otp-unofficial.jar /usr/local/share/java/otp-unofficial.jar - -COPY otp-1.5.2-openmove.jar /usr/local/share/java/otp-unofficial.jar - -COPY otp.sh /usr/local/bin/ -COPY otp-unofficial.sh /usr/local/bin/ - -COPY infrastructure/docker/otp/docker-entrypoint.sh /docker-entrypoint.sh - -COPY build-config.json /conf/ -COPY router-config.json /conf/ -COPY envconfig.js /conf/ - -COPY ./gtfs2bbox /gtfs2bbox -COPY ./gtfs-import-task /gtfs-import-task - -RUN chmod 755 /gtfs-import-task/gtfs-download.sh - -RUN cd /gtfs2bbox && \ - npm install - -RUN chmod 755 /usr/local/bin/* -RUN chmod 755 /docker-entrypoint.sh - -ENTRYPOINT ["/bin/bash"] -CMD ["/docker-entrypoint.sh"] +ENTRYPOINT java $JAVA_OPTS -cp @/app/jib-classpath-file @/app/jib-main-class-file /var/otp/ --load --serve \ No newline at end of file