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 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" ] 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.