Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions windows/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# escape=`

FROM mcr.microsoft.com/windows/servercore:1803

# Install the Visual C++ Build tools
#
# Error code 3010 indicates a restart is required to complete installation, but
# the command was otherwise successful.
SHELL ["cmd", "/S", "/C"]
ADD https://aka.ms/vs/15/release/vs_buildtools.exe C:\TEMP\vs_buildtools.exe
RUN C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache `
--add "Microsoft.VisualStudio.Workload.VCTools" `
--includeRecommended `
|| IF "%ERRORLEVEL%"=="3010" EXIT 0

SHELL ["powershell", "-Command"]

# Install vcpkg
ADD https://github.com/Microsoft/vcpkg/archive/master.zip C:\TEMP\vcpkg-master.zip
RUN $ErrorActionPreference = 'Stop'; `
Expand-Archive -Path C:\TEMP\vcpkg-master.zip -DestinationPath .; `
cd .\vcpkg-master; `
.\bootstrap-vcpkg.bat; `
.\vcpkg integrate install

# Install packages
COPY vc-packages.txt C:\
RUN .\vcpkg-master\vcpkg install @(Get-Content C:\vc-packages.txt)

CMD ["powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]
44 changes: 44 additions & 0 deletions windows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Windows build environment for rust crates

This repository contains the source of a Docker container the Rust project uses
to build third-party crates on Windows. It is based on **Windows Server Core,
version 1803**, and contains all the native dependencies used by the Rust
crates we know of.

## Dependencies

All dependencies listed in `vc-packages.txt` will be installed into the
image with `vcpkg`.

## Using the docker image

This image must be run on a Windows host with both containerization and Hyper-V
enabled (Windows 10 Pro or Windows Server >=2016). If you wish to run `crater`
on an Azure VM, this requires a virtual machine image tagged with "v3".


Hyper-V can be enabled in [the GUI][hyperv] or in `Powershell` with:

```powershell
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
```

A reboot is required for this to take effect.

[hyperv]: https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v#enable-the-hyper-v-role-through-settings


The Docker host must have a [build number][build] equal to that of the image
you wish to run (presently `mcr.microsoft.com/windows/servercore:1803`).

[Docker Desktop][] is required to run native Windows containers; this image
will not work with Docker Toolbox. Once installed, ensure that Docker Desktop
is configured to run Windows containers by right-clicking the icon in the
dock, or by running the following in `Powershell`:

```powershell
$Env:ProgramFiles\Docker\Docker\DockerCli.exe -SwitchDaemon .
```

[Docker Desktop]: https://hub.docker.com/editions/community/docker-ce-desktop-windows
[build]: https://docs.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/version-compatibility
1 change: 1 addition & 0 deletions windows/vc-packages.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
zlib