Skip to content

Commit

Permalink
Build graph before building container
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardehrenfried committed Jan 22, 2024
1 parent 6fd7e46 commit 54e278f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 58 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 5 additions & 3 deletions build-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
{
Expand Down
4 changes: 2 additions & 2 deletions build-graph.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
56 changes: 5 additions & 51 deletions infrastructure/docker/otp/Dockerfile
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 54e278f

Please sign in to comment.