Skip to content

Commit

Permalink
Mise à disposition validateur MobilityData GTFS v3 + freezing des ver…
Browse files Browse the repository at this point in the history
…sions (#15)

* Freeze version of gtfs-to-geojson

* Freeze version of transport-validator

* Freeze version of gtfs-to-netex converter

* (major) bump MobilityData GTFS validator to v3

* Add sanity check for GTFS validator

* Add git

* Replace snapshot copy by self-build for now

See CUTR-at-USF/gtfs-realtime-validator#406

* Move jars to /usr/local/bin & add more quick testing

* Freeze the JDK too

* Fix JDK test

* Really really fix the build
  • Loading branch information
thbar authored Feb 2, 2022
1 parent fa474dc commit 59015db
Showing 1 changed file with 31 additions and 9 deletions.
40 changes: 31 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@ FROM ubuntu:focal
# https://github.com/rust-transit/gtfs-to-geojson.git (rust app)
FROM rust:latest as builder
WORKDIR /
RUN git clone --depth=1 --branch main --single-branch https://github.com/rust-transit/gtfs-to-geojson.git
# this repo has no tagged releases ; we pin the version based on latest verified commit instead
RUN git clone https://github.com/rust-transit/gtfs-to-geojson.git
RUN git -C gtfs-to-geojson checkout 3f21e496e433704cf879ee453eaa4cb41cf06e7c
WORKDIR /gtfs-to-geojson
RUN cargo build --release
RUN strip ./target/release/gtfs-geojson

# https://github.com/etalab/transport-validator.git (rust app)
WORKDIR /
RUN git clone --depth=1 --branch=master --single-branch https://github.com/etalab/transport-validator.git
# this repo has no tagged releases ; we pin the version based on latest verified commit instead
RUN git clone https://github.com/etalab/transport-validator.git
RUN git -C transport-validator checkout 302e62e787dc28b80f9e8e80ceadc80be71aafbc
WORKDIR /transport-validator
RUN cargo build --release
RUN strip ./target/release/main
Expand All @@ -30,7 +34,8 @@ RUN strip ./target/release/main
#
FROM kisiodigital/rust-ci:latest-proj8.1.0 as builder_proj
WORKDIR /
RUN git clone --depth=1 --branch=master --single-branch https://github.com/CanalTP/transit_model
# we pin the version to avoid unexpected changes due to rebuild on our side
RUN git clone --depth=1 --branch=v0.46.0 --single-branch https://github.com/CanalTP/transit_model
WORKDIR /transit_model
# NOTE: when using the kisio rust-ci as a base image, CARGO_TARGET_DIR is set to something like `/tmp/cargo-release`.
# To avoid breaking the build in case of variable change upstream, we instead force the build to be local, which
Expand All @@ -42,13 +47,25 @@ FROM ubuntu:focal
COPY --from=builder /gtfs-to-geojson/target/release/gtfs-geojson /usr/local/bin/gtfs-geojson
COPY --from=builder /transport-validator/target/release/main /usr/local/bin/transport-validator
COPY --from=builder_proj /transit_model/target/release/gtfs2netexfr /usr/local/bin/gtfs2netexfr
RUN apt-get -y update && apt-get -y install libssl-dev
RUN apt-get -y install default-jre
RUN apt-get -y install curl

RUN apt-get -y update
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install libssl-dev default-jre curl git

# https://github.com/MobilityData/gtfs-validator (java app)
RUN curl --location -O https://github.com/MobilityData/gtfs-validator/releases/download/v2.0.0/gtfs-validator-v2.0.0_cli.jar
# https://github.com/MobilityData/gtfs-validator/releases
RUN curl --location -O https://github.com/MobilityData/gtfs-validator/releases/download/v3.0.0/gtfs-validator-v3.0.0_cli.jar
RUN cp gtfs-validator-v3.0.0_cli.jar /usr/local/bin

# https://github.com/CUTR-at-USF/gtfs-realtime-validator/blob/master/gtfs-realtime-validator-lib/README.md#batch-processing (java app)
RUN curl --location -O https://s3.amazonaws.com/gtfs-rt-validator/travis_builds/gtfs-realtime-validator-lib/1.0.0-SNAPSHOT/gtfs-realtime-validator-lib-1.0.0-SNAPSHOT.jar
# freeze by commit + self-compile for now (https://github.com/CUTR-at-USF/gtfs-realtime-validator/issues/406)
RUN git clone https://github.com/CUTR-at-USF/gtfs-realtime-validator.git
RUN git -C gtfs-realtime-validator checkout fca9c73b3d3b377c606065648750b777d36ad553
WORKDIR /gtfs-realtime-validator/gtfs-realtime-validator-lib
RUN apt-get -y install maven
RUN mvn package
RUN cp target/gtfs-realtime-validator-lib-1.0.0-SNAPSHOT.jar /usr/local/bin

WORKDIR /

# for gtfs2netexfr
RUN apt-get -y install libtiff5 libcurl3-nss
Expand All @@ -63,4 +80,9 @@ RUN /usr/local/bin/gtfs-geojson --help
RUN /usr/local/bin/transport-validator --help
RUN /usr/local/bin/gtfs2netexfr --help

# TODO: test java binaries (they do not have a `--help` currently I believe)
# the --help returns a non-zero exit code ; we grep on a well-known text as a quick test
RUN java -jar /usr/local/bin/gtfs-validator-v3.0.0_cli.jar --help | grep "Location of the input GTFS ZIP"
# there is no --version or --help here currently
RUN java -jar /usr/local/bin/gtfs-realtime-validator-lib-1.0.0-SNAPSHOT.jar 2>&1 | grep "For batch mode you must provide a path and file name to GTFS data"
# freeze the JDK too (installed via default-jre, so no explicit version)
RUN java -version 2>&1 | grep "OpenJDK Runtime Environment (build 11."

0 comments on commit 59015db

Please sign in to comment.