diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 82d42f62be..a6b4f592cf 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -33,6 +33,9 @@ jobs: eval $(go env | sed -r 's/^(set )?(\w+)=("?)(.*)\3$/\2="\4"/gm') if [[ "${{ matrix.platform }}" == "windows-latest" ]]; then + # Always use the nanoserver base image, which matches the Windows + # version used by the GitHub Actions Windows runner. + rm .ko.yaml export KO_DEFAULTBASEIMAGE=mcr.microsoft.com/windows/nanoserver:1809 fi diff --git a/.ko.yaml b/.ko.yaml new file mode 100644 index 0000000000..6371051bce --- /dev/null +++ b/.ko.yaml @@ -0,0 +1,2 @@ +baseImageOverrides: + github.com/google/ko: golang:1.17 diff --git a/README.md b/README.md index 614fd074f0..e0e81227c5 100644 --- a/README.md +++ b/README.md @@ -466,9 +466,11 @@ You can try out building a Windows container image by [setting the base image](# For example, to build a Windows container image for `ko`, from within this repo: ``` -KO_DEFAULTBASEIMAGE=mcr.microsoft.com/windows/nanoserver:1809 ko publish ./ --platform=windows/amd64 +ko publish ./ --platform=windows/amd64 ``` +This works because the `ko` image is configured in [`.ko.yaml`](./.ko.yaml) to be based on a `golang` base image, which provides platform-specific images for both Linux and Windows. + ### Known issues 🐛 - Symlinks in `kodata` are ignored when building Windows images; only regular files and directories will be included in the Windows image.