83 lines
2.7 KiB
Plaintext
83 lines
2.7 KiB
Plaintext
|
# Visual Studio Build Tools Container
|
||
|
|
||
|
This project builds a minimal (ish) Docker container for the Visual Studio build tools (MSVC).
|
||
|
A second image is constructed for Windows XP Visual Studio build tools (v141_xp).
|
||
|
Powershell scripts are included to try and recreate these build environments directly on a Windows 10 workstation.
|
||
|
|
||
|
# Requirements
|
||
|
|
||
|
A Windows 10 workstation or VM with minimum 8 GB of memory is required.
|
||
|
The more concurrent containers you have running, the more memory and CPU cores is required.
|
||
|
|
||
|
**Each container requires one core and approximately 4 GB of memory.**
|
||
|
|
||
|
0. Download and install [Docker for Windows](https://download.docker.com/win/stable/Docker%20for%20Windows%20Installer.exe).
|
||
|
|
||
|
- Select "Switch to Windows Containers" when prompted.
|
||
|
|
||
|
# Build Image
|
||
|
|
||
|
Prior to running a container the Docker image will need to be built.
|
||
|
This step is automated but time consuming.
|
||
|
It only needs to be built once.
|
||
|
|
||
|
0. Open powershell and navigate to this project.
|
||
|
|
||
|
0. Run docker compose with the configuration provided by this project in `docker-compose.yaml`
|
||
|
|
||
|
```bash
|
||
|
docker-compose build
|
||
|
```
|
||
|
|
||
|
This will install both the Windows v142 and Windows XP v141_xp build chains into their respective containers.
|
||
|
|
||
|
Reference these containers later with the names:
|
||
|
|
||
|
- win_build
|
||
|
|
||
|
- winxp_build
|
||
|
|
||
|
# Run Containers
|
||
|
|
||
|
It is recommend that a docker compose file is used to run these containers as paths on Windows can be a bit tricky.
|
||
|
Make sure to use forward slashes in paths used within docker compose files.
|
||
|
|
||
|
Below is an example `docker-compose.yaml` file used to build a project configured with cmake.
|
||
|
|
||
|
```yaml
|
||
|
version: '3'
|
||
|
|
||
|
services:
|
||
|
win64_build_release:
|
||
|
image: win_build
|
||
|
volumes:
|
||
|
- .:C:/source/
|
||
|
command: msbuild .
|
||
|
```
|
||
|
|
||
|
- `volumes:` are mounted within the Docker container.
|
||
|
|
||
|
- `C:/source/` is assumed to be the project being build with MSVC.
|
||
|
|
||
|
- `command:` passes arguments to `Microsoft.VisualStudio.DevShell` unless entrypoint is otherwise defined.
|
||
|
|
||
|
To build a Windows XP project use the `image: winxp_build` container image.
|
||
|
|
||
|
# Build Your Windows Project
|
||
|
|
||
|
The above `docker-compose.yaml` file should be stored within your project and will reference the built Docker images by name, not by path.
|
||
|
Once this file is created within your project run the following command to begin the build process.
|
||
|
|
||
|
```bash
|
||
|
docker-compose up
|
||
|
```
|
||
|
|
||
|
# Optional Workstation Scripts
|
||
|
|
||
|
We have done our best to provide powershell scripts that should reproduce these build environments on a Windows 10 workstation.
|
||
|
They can be ran but should be evaluated as there is no error checking.
|
||
|
|
||
|
- [win_build_tools_install.ps1](win_build_tools_install.ps1)
|
||
|
|
||
|
- [winxp_build_tools_install.ps1](winxp_build_tools_install.ps1)
|