37 lines
901 B
Docker
37 lines
901 B
Docker
FROM ortools/cmake:debian_swig AS env
|
|
|
|
RUN apt-get update -qq \
|
|
&& apt-get install -yq default-jdk maven \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
ENV JAVA_HOME=/usr/lib/jvm/default-java
|
|
|
|
FROM env AS devel
|
|
WORKDIR /home/project
|
|
COPY . .
|
|
|
|
ARG CMAKE_BUILD_PARALLEL_LEVEL
|
|
ENV CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL:-4}
|
|
|
|
FROM devel AS build
|
|
RUN cmake -S. -Bbuild -DBUILD_JAVA=ON -DSKIP_GPG=ON \
|
|
-DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF
|
|
RUN cmake --build build --target all -v
|
|
RUN cmake --build build --target install
|
|
|
|
FROM build AS test
|
|
RUN CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test
|
|
|
|
FROM env AS install_env
|
|
COPY --from=build /usr/local /usr/local/
|
|
|
|
FROM install_env AS install_devel
|
|
WORKDIR /home/sample
|
|
COPY cmake/samples/java .
|
|
|
|
FROM install_devel AS install_build
|
|
RUN mvn compile
|
|
|
|
FROM install_build AS install_test
|
|
RUN mvn test
|