Skip to content

Commit

Permalink
Add .ko.yaml to base ko container image on golang:1.17 (ko-build#533)
Browse files Browse the repository at this point in the history
* Add .ko.yaml to base ko container image on golang:1.17

Ignore this in e2e tests, since even though golang:1.17 provides a
Windows base image, ko's base image platform selection doesn't take
osversion into account. The e2e tests don't exercise golang usage at
all, so it shouldn't matter.

* Update README
  • Loading branch information
imjasonh authored Dec 14, 2021
1 parent 2ba70fc commit 96bedf1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions .ko.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
baseImageOverrides:
github.com/google/ko: golang:1.17
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 96bedf1

Please sign in to comment.