From 13ea9afdbcdadb0ea553d3cb60e23e0a1a06e51a Mon Sep 17 00:00:00 2001 From: Yatima Santamorena Date: Tue, 12 Oct 2021 15:19:14 +0200 Subject: [PATCH 1/3] Add Dockerfile to build ConfuserEx2 --- Dockerfile | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..ce0842ec --- /dev/null +++ b/Dockerfile @@ -0,0 +1,51 @@ +# escape=` + +FROM mcr.microsoft.com/dotnet/framework/sdk:3.5-windowsservercore-ltsc2019 as Build + +# Set cmd as default shell +SHELL ["cmd", "/S", "/C"] + +# Setup vs_buildtools.exe +ADD https://aka.ms/vs/16/release/channel C:\TEMP\VisualStudio.chman +ADD https://aka.ms/vs/16/release/vs_buildtools.exe C:\TEMP\vs_buildtools.exe + +# VS2019 C++ stuff +RUN C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache ` + --installPath C:\BuildTools ` + --channelUri C:\TEMP\VisualStudio.chman ` + --installChannelUri C:\TEMP\VisualStudio.chman ` + --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 ` + || if "%ERRORLEVEL%"=="3010" exit /b 0 + +# 10 SDK +RUN C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache ` + --installPath C:\BuildTools ` + --channelUri C:\TEMP\VisualStudio.chman ` + --installChannelUri C:\TEMP\VisualStudio.chman ` + --add Microsoft.VisualStudio.Component.Windows10SDK.19041 ` + || if "%ERRORLEVEL%"=="3010" exit /b 0 + +# NetCore SDK +RUN C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache ` + --installPath C:\BuildTools ` + --channelUri C:\TEMP\VisualStudio.chman ` + --installChannelUri C:\TEMP\VisualStudio.chman ` + --add Microsoft.NetCore.Component.SDK ` + || if "%ERRORLEVEL%"=="3010" exit /b 0 + +# Add the source code +ADD . C:/source +WORKDIR C:/source + +# Restore nuget packages +RUN msbuild Confuser2.sln /t:Restore /p:Configuration=Release + +# Set VS environment and compile +RUN call C:\BuildTools\VC\Auxiliary\Build\vcvarsall.bat amd64 && ` + msbuild /maxCpuCount Confuser2.sln /p:Configuration=Release /verbosity:minimal + +# Create new image +FROM mcr.microsoft.com/dotnet/framework/runtime:3.5-windowsservercore-ltsc2019 as ConfuserEx2 +COPY --from=Build C:/source/Confuser.CLI/bin/Release/net461 C:/ConfuserEx2 + +ENTRYPOINT [ "C:/ConfuserEx2/Confuser.CLI.exe" ] From 623ed8ded723abd17d165fee7d4cc1e48fb213a4 Mon Sep 17 00:00:00 2001 From: Yatima Santamorena Date: Tue, 12 Oct 2021 15:19:24 +0200 Subject: [PATCH 2/3] add .dockerignore --- .dockerignore | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..559bd28d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +.dockerignore +.github +docs +Dockerfile +chocolatey-packages From fb5ec407ebee5cff8953c81850ebc11f4583e692 Mon Sep 17 00:00:00 2001 From: Yatima Santamorena Date: Tue, 12 Oct 2021 15:19:50 +0200 Subject: [PATCH 3/3] Dockerfile docs --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 64826b03..6012684f 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,20 @@ Confuser.CLI.exe The project file is a ConfuserEx Project (`*.crproj`). The format of project file can be found in [docs\ProjectFormat.md][project_format] +## Dockerfile + +Compile + +```cmd +docker build --memory=4GB --tag confuserex2 . +``` + +Use + +```cmd +docker run --rm --cpus=%NUMBER_OF_PROCESSORS% --memory=4GB --volume %CD%:C:/source confuserex2 C:/source/project.crproj +``` + # Bug Report See the [Issues Report][issues] section of website.