opengeospatial / ets-ogcapi-features10

Public Repository for the OGC API - Features Compliance Test Suite
Other
16 stars 6 forks source link

Docker image for running tests via CLI #197

Open jnystad opened 2 years ago

jnystad commented 2 years ago

Is your feature request related to a problem? Please describe. The docker image provided is built to run the full TEAM Engine server, but this is not necessarily the easiest way for non-java developers to get access to this test suite.

Describe the solution you'd like It would be great if you provided a docker image that was rigged for the CLI invocation only.

Additional context

A Dockerfile I created to make this image myself that tries to do some build phases for quicker development iteration:

FROM maven:3.8-openjdk-18

WORKDIR /build/

COPY pom.xml .

RUN mvn --version

# Pre-download all dependencies to increase caching in docker builds
RUN mvn dependency:resolve dependency:resolve-plugins dependency:copy-dependencies dependency:go-offline -Pdocker

# Copy actual source files
COPY ./src ./src

# Install offline to avoid triggering new dependency update
RUN mvn install -DskipTests -Dmaven.javadoc.skip

# TODO: Should get the version from build context
ARG VERSION=1.5-SNAPSHOT
ARG OUTPUT_DIR=/build/run/output
ARG TEST_RUN_PROPS=/build/run/test-run-props.xml

ENV VERSION=${VERSION}
ENV OUTPUT_DIR=${OUTPUT_DIR}
ENV TEST_RUN_PROPS=${TEST_RUN_PROPS}

CMD ["sh", "-c", "java -jar /build/target/ets-ogcapi-features10-${VERSION}-aio.jar -o ${OUTPUT_DIR} -h true ${TEST_RUN_PROPS}"]

I'm not a Java developer, so this may or may not be a good approach, but it works OK for me.

Invocation example:

docker container run --mount type=bind,source=/path/to/run,target=/build/run image-name

Note the required bound mount to pass test-run-props.xml in, and get the resulting output written to local directory.

It should probably be optimized to copy the built artifacts to a new runtime image to reduce the size of the produced image.

dstenger commented 2 years ago

Thank you for providing this feature request.

A similar idea was already documented here: https://github.com/opengeospatial/teamengine-docker/issues/39

We will discuss this in the CITE team.