This repository has been archived by the owner on Feb 12, 2024. It is now read-only.
forked from opentripplanner/OpenTripPlanner
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
51 lines (38 loc) · 2.3 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
FROM debian:stable as builder
RUN apt-get update && apt-get install -y --no-install-recommends curl git wget ca-certificates
WORKDIR /java/
RUN curl -Lo jre8.tar.gz https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u322-b06/OpenJDK8U-jre_x64_linux_hotspot_8u322b06.tar.gz
RUN tar xvf jre8.tar.gz && rm jre8.tar.gz
RUN curl -Lo jdk17.tar.gz https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.2%2B8/OpenJDK17U-jdk_x64_linux_hotspot_17.0.2_8.tar.gz
RUN tar xvf jdk17.tar.gz && rm jdk17.tar.gz
ENV JAVA_HOME_JDK_17=/java/jdk-17.0.2+8/
RUN curl -Lo jdk8.tar.gz https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u322-b06/OpenJDK8U-jdk_x64_linux_hotspot_8u322b06.tar.gz
RUN tar xvf jdk8.tar.gz && rm jdk8.tar.gz
ENV JAVA_HOME_JDK_8=/java/jdk8u322-b06/
RUN curl -Lo maven.tar.gz https://archive.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
RUN tar xvf maven.tar.gz && rm maven.tar.gz
ENV PATH="/java/apache-maven-3.6.3/bin/:$PATH"
WORKDIR /build/onebusaway-gtfs-modules
RUN git clone --depth 1 https://github.com/mbta/onebusaway-gtfs-modules .
RUN JAVA_HOME=$JAVA_HOME_JDK_17 ./build.sh
WORKDIR /build/OpenTripPlanner
COPY . .
ARG MBTA_GTFS_URL=https://mbta-gtfs-s3.s3.amazonaws.com/google_transit.zip
RUN MBTA_GTFS_URL="$MBTA_GTFS_URL" ./mbta/update_gtfs.sh
RUN ./mbta/update_pbf.sh
ENV JAVA_HOME="$JAVA_HOME_JDK_8" PATH="$JAVA_HOME_JDK_8/bin:$PATH"
RUN ./mbta/build.sh
FROM debian:stable-slim as runner
RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends dumb-init
RUN useradd -MU otp
USER otp
COPY --from=builder --chown=otp:otp /build/OpenTripPlanner/otp-1.4.0*-shaded.jar /dist/OpenTripPlanner/
COPY --from=builder --chown=otp:otp /build/OpenTripPlanner/var/graphs/mbta/Graph.obj /dist/OpenTripPlanner/var/graphs/mbta/
COPY --from=builder --chown=otp:otp /build/OpenTripPlanner/var/graphs/mbta/*.json /dist/OpenTripPlanner/var/graphs/mbta/
COPY --from=builder --chown=otp:otp /java/jdk8u322-b06-jre /java/jdk8u322-b06-jre
ENV JAVA_HOME="/java/jdk8u322-b06-jre"
ENV PATH="$JAVA_HOME/bin:$PATH"
EXPOSE 5000
WORKDIR /dist/OpenTripPlanner
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["java", "-Xmx6G", "-jar", "otp-1.4.0-SNAPSHOT-shaded.jar", "--basePath", "var/", "--verbose", "--router", "mbta", "--server", "--port", "5000"]