mirror of
https://github.com/ko-build/ko.git
synced 2025-02-07 19:30:23 +02:00
Look for ko.local in the daemon (#371)
* Look for ko.local in the daemon * Update README
This commit is contained in:
parent
23ecf4753b
commit
82e899db0c
@ -147,6 +147,12 @@ identified by `KO_DOCKER_REPO`.
|
||||
`ko` can also publish images to a local Docker daemon, if available, by setting
|
||||
`KO_DOCKER_REPO=ko.local`, or by passing the `--local` (`-L`) flag.
|
||||
|
||||
Locally-published images can be used as a base image for other `ko` images:
|
||||
|
||||
```yaml
|
||||
defaultBaseImage: ko.local/example/base/image
|
||||
```
|
||||
|
||||
`ko` can also publish images to a local [KinD](https://kind.sigs.k8s.io)
|
||||
cluster, if available, by setting `KO_DOCKER_REPO=kind.local`.
|
||||
|
||||
|
@ -30,10 +30,12 @@ import (
|
||||
"github.com/google/go-containerregistry/pkg/authn"
|
||||
"github.com/google/go-containerregistry/pkg/name"
|
||||
v1 "github.com/google/go-containerregistry/pkg/v1"
|
||||
"github.com/google/go-containerregistry/pkg/v1/daemon"
|
||||
"github.com/google/go-containerregistry/pkg/v1/remote"
|
||||
"github.com/google/go-containerregistry/pkg/v1/types"
|
||||
"github.com/google/ko/pkg/build"
|
||||
"github.com/google/ko/pkg/commands/options"
|
||||
"github.com/google/ko/pkg/publish"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
@ -68,6 +70,12 @@ func getBaseImage(platform string, bo *options.BuildOptions) build.GetBase {
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("parsing base image (%q): %v", baseImage, err)
|
||||
}
|
||||
|
||||
// For ko.local, look in the daemon.
|
||||
if ref.Context().RegistryStr() == publish.LocalDomain {
|
||||
return daemon.Image(ref)
|
||||
}
|
||||
|
||||
userAgent := ua()
|
||||
if bo.UserAgent != "" {
|
||||
userAgent = bo.UserAgent
|
||||
|
Loading…
x
Reference in New Issue
Block a user