Skip to content

Instantly share code, notes, and snippets.

@abgeana
Last active August 15, 2022 22:56
Embed
What would you like to do?
LibAFL Windows Dockerfile
# escape=`
FROM mcr.microsoft.com/windows:20H2
# Restore the default Windows shell for correct batch processing
SHELL ["cmd", "/S", "/C"]
RUN curl -SL --output vs_buildtools.exe https://aka.ms/vs/17/release/vs_buildtools.exe
# Install the relevant components via their IDs
# https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools?view=vs-2022
RUN start /w vs_buildtools.exe --quiet --wait --norestart --nocache `
--installPath "%ProgramFiles(x86)%\Microsoft Visual Studio\2022\BuildTools" `
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
--add Microsoft.VisualStudio.Component.VC.CMake.Project `
--add Microsoft.VisualStudio.Component.VC.ATL `
--add Microsoft.VisualStudio.Component.Windows10SDK.19041 `
--add Microsoft.VisualStudio.Component.TestTools.BuildTools
# Install chocolatey
ENV chocolateyUseWindowsCompression false
RUN powershell -Command `
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
# Install python3 via chocolatey
RUN choco install -y python3
# Install git via chocolatey
RUN choco install -y git
# Install 7zip via chocolatey
RUN choco install -y 7zip.install
# Install rust
RUN curl -SL -o rustup-init.exe https://win.rustup.rs/x86_64
RUN .\\rustup-init.exe -y
# Tell rustc to link against the libcmt.lib static runtime (applicable on windows only).
# There is some duplicate symbol weirdness when using asan and linking against the msvcrt.lib dynamic runtime.
# https://doc.rust-lang.org/reference/linkage.html#static-and-dynamic-c-runtimes
ENV RUSTFLAGS '-C target-feature=+crt-static'
# Define the entry point for the docker container.
# This entry point starts the developer command prompt and launches the PowerShell shell.
ENTRYPOINT ["C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat", "&&", "powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment