44 lines
1.2 KiB
Docker
44 lines
1.2 KiB
Docker
FROM ortools/cmake:opensuse_swig AS env
|
|
|
|
# .NET install
|
|
# see: https://docs.microsoft.com/en-us/dotnet/core/install/linux-opensuse
|
|
RUN zypper refresh \
|
|
&& zypper install -y wget tar awk gzip libicu-devel findutils
|
|
|
|
## .Net 8.0
|
|
# see: https://learn.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#scripted-install
|
|
RUN wget -q "https://dot.net/v1/dotnet-install.sh" \
|
|
&& chmod a+x dotnet-install.sh \
|
|
&& ./dotnet-install.sh -c 8.0 -i /usr/local/bin
|
|
# Trigger first run experience by running arbitrary cmd
|
|
RUN dotnet --info
|
|
|
|
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 -version
|
|
RUN cmake -S. -Bbuild -DBUILD_DOTNET=ON -DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF
|
|
RUN cmake --build build --target all -v
|
|
RUN cmake --build build --target install -v
|
|
|
|
FROM build AS test
|
|
RUN CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test -v
|
|
|
|
FROM env AS install_env
|
|
WORKDIR /home/sample
|
|
COPY --from=build /home/project/build/dotnet/packages/*.nupkg ./
|
|
|
|
FROM install_env AS install_devel
|
|
COPY cmake/samples/dotnet .
|
|
|
|
FROM install_devel AS install_build
|
|
RUN dotnet build
|
|
|
|
FROM install_build AS install_test
|
|
RUN dotnet test
|