Add option to configure default platforms (#897)

This commit is contained in:
Reto Lehmann
2022-12-12 10:07:39 -05:00
committed by GitHub
parent c4af8c2cd0
commit 7dc51c0cf6
6 changed files with 71 additions and 1 deletions
+24
View File
@@ -83,6 +83,30 @@ The `ldflags` default value is `[]`.
only the `env`, `flags` and `ldflags` fields are currently supported. Also, the
templating support is currently limited to using environment variables only.
### Setting default platforms
By default, `ko` builds images based on the platform it runs on. If your target platform differs from your build platform you can specify the build platform:
**As a parameter**
See [Multi-Platform Images](./features/multi-platform.md).
**In .ko.yaml**
Add this to your `.ko.yaml` file:
```yaml
defaultPlatforms:
- linux/arm64
- linux/amd64
```
You can also use the `KO_DEFAULTPLATFORMS` environment variable to set the default platforms, which overrides the YAML configuration:
```shell
KO_DEFAULTPLATFORMS=linux/arm64,linux/amd64
```
## Naming Images
`ko` provides a few different strategies for naming the image it pushes, to