Skip to content

Commit 6c76fb2

Browse files
authored
Merge pull request #7 from ecstatic-morse/windows
Build and publish Windows image on AppVeyor
2 parents 1121c22 + 2536fc3 commit 6c76fb2

File tree

5 files changed

+50
-5
lines changed

5 files changed

+50
-5
lines changed

appveyor.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
version: 1.0.{build}
2+
image: Visual Studio 2017
3+
4+
platform:
5+
- x86
6+
7+
environment:
8+
PUSH_IMAGE: 'rustops/crates-build-env-windows'
9+
10+
# If Docker is currently configured to run Linux containers, we need to switch
11+
# to running Windows containers.
12+
#
13+
# https://github.com/docker/cli/issues/1042
14+
init:
15+
# - ps: $env:ProgramFiles/Docker/Docker/DockerCli.exe -SwitchDaemon
16+
17+
build_script:
18+
- ps: ./windows/ci/build.ps1
19+
20+
deploy_script:
21+
- ps: if ($env:APPVEYOR_REPO_BRANCH -eq "master") { ./windows/ci/publish.ps1 }
22+

windows/Dockerfile

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# escape=`
22

3-
FROM mcr.microsoft.com/windows/servercore:1803
3+
ARG BASE_IMAGE_VER=:1803
4+
5+
FROM mcr.microsoft.com/windows/servercore${BASE_IMAGE_VER}
46

57
# Install the Visual C++ Build tools
68
#

windows/README.md

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# Windows build environment for rust crates
22

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

87
## Dependencies
98

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

18+
The version of the base image can be configured by passing `--build-arg
19+
BASE_IMAGE_VER=${YOUR_DESIRED_VERSION_NUMBER}` to `docker build`. It defaults
20+
to `:1803` (note the leading colon) which specifies Windows Server Core,
21+
version 1803.
1922

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

@@ -29,7 +32,7 @@ A reboot is required for this to take effect.
2932

3033

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

3437
[Docker Desktop][] is required to run native Windows containers; this image
3538
will not work with Docker Toolbox. Once installed, ensure that Docker Desktop

windows/ci/build.ps1

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
$ErrorActionPreference = "Stop"
2+
3+
$ContainerBase = '@sha256:c06b4bfaf634215ea194e6005450740f3a230b27c510cf8facab1e9c678f3a99'
4+
5+
docker build `
6+
-t "$env:PUSH_IMAGE" `
7+
--build-arg "BASE_IMAGE_VER=$ContainerBase" `
8+
windows

windows/ci/publish.ps1

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
$ErrorActionPreference = "Stop"
2+
3+
# Build the image
4+
./windows/ci/build.ps1
5+
6+
# Log in to dockerhub
7+
[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($Env:DOCKER_PASSWORD)).Trim() `
8+
| docker login --username "$Env:DOCKER_USERNAME" --password-stdin
9+
10+
docker push "$env:PUSH_IMAGE"

0 commit comments

Comments
 (0)