46 lines
1.5 KiB
Docker
46 lines
1.5 KiB
Docker
FROM ortools/cmake:opensuse_swig AS env
|
|
# see: https://docs.microsoft.com/en-us/dotnet/core/install/linux-opensuse
|
|
RUN zypper update -y \
|
|
&& zypper install -y wget tar gzip libicu-devel
|
|
|
|
# .NET install
|
|
RUN mkdir -p /usr/share/dotnet \
|
|
&& ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet
|
|
|
|
# see: https://dotnet.microsoft.com/download/dotnet-core/6.0
|
|
RUN dotnet_sdk_version=6.0.100 \
|
|
&& wget -qO dotnet.tar.gz \
|
|
"https://dotnetcli.azureedge.net/dotnet/Sdk/${dotnet_sdk_version}/dotnet-sdk-${dotnet_sdk_version}-linux-x64.tar.gz" \
|
|
&& dotnet_sha512='cb0d174a79d6294c302261b645dba6a479da8f7cf6c1fe15ae6998bc09c5e0baec810822f9e0104e84b0efd51fdc0333306cb2a0a6fcdbaf515a8ad8cf1af25b' \
|
|
&& echo "$dotnet_sha512 dotnet.tar.gz" | sha512sum -c - \
|
|
&& tar -C /usr/share/dotnet -oxzf dotnet.tar.gz \
|
|
&& rm dotnet.tar.gz
|
|
# Trigger first run experience by running arbitrary cmd
|
|
RUN dotnet --info
|
|
|
|
FROM env AS devel
|
|
WORKDIR /home/project
|
|
COPY . .
|
|
|
|
FROM devel AS build
|
|
RUN cmake -version
|
|
RUN cmake -S. -Bbuild -DBUILD_DOTNET=ON -DUSE_DOTNET_CORE_31=OFF -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
|