mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-28 18:38:40 +00:00
docs: add local image build section (#4449)
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com> Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
This commit is contained in:
parent
2b495c7ef3
commit
26989b0604
1 changed files with 88 additions and 0 deletions
|
@ -7,6 +7,9 @@ It contains instructions to build, run, and test Kyverno.
|
|||
- [Tools](#tools)
|
||||
- [Building and publishing an image locally](#building-and-publishing-an-image-locally)
|
||||
- [Building local binaries](#building-local-binaries)
|
||||
- [Building local images](#building-local-images)
|
||||
- [Building local images with docker](#building-local-images-with-docker)
|
||||
- [Building local images with ko](#building-local-images-with-ko)
|
||||
|
||||
## Tools
|
||||
|
||||
|
@ -68,6 +71,91 @@ make build-cli
|
|||
|
||||
The binary should be created at `./cmd/cli/kubectl-kyverno/kubectl-kyverno`.
|
||||
|
||||
## Building local images
|
||||
|
||||
In the same spirit as [building local binaries](#building-local-binaries), you can build local docker images instead of local binaries.
|
||||
|
||||
Currently, we are supporting two build systems:
|
||||
- [Building local images with docker](#building-local-images-with-docker)
|
||||
- [Building local images with ko](#building-local-images-with-ko)
|
||||
|
||||
> **Note**: We started with `docker` and are progressively moving to `ko`.
|
||||
|
||||
As the `ko` based build system matures, we will deprecate and remove `docker` based builds.
|
||||
|
||||
Choosing between `docker` and `ko` boils down to a prefix when invoking `make` targets.
|
||||
For example:
|
||||
- `make docker-build-kyverno` creates a docker image using the `docker` build system
|
||||
- `make ko-build-kyverno` creates a docker image using the `ko` build system
|
||||
|
||||
<!-- TODO: explain the way images are tagged. -->
|
||||
|
||||
### Building local images with docker
|
||||
|
||||
When building local images with docker you can specify the registry used to create the image names by setting the `REGISTRY` environment variable (default value is `ghcr.io`).
|
||||
|
||||
> **Note**: You can build all local images at once by running `make docker-build-all`.
|
||||
|
||||
#### Building kyvernopre image locally
|
||||
|
||||
To build `kyvernopre` image on your local system, run:
|
||||
```console
|
||||
make docker-build-kyvernopre
|
||||
```
|
||||
|
||||
The resulting image should be available locally, named `ghcr.io/kyverno/kyvernopre` (by default, if `REGISTRY` environment variable was not set).
|
||||
|
||||
#### Building kyverno image locally
|
||||
|
||||
To build `kyverno` image on your local system, run:
|
||||
```console
|
||||
make docker-build-kyverno
|
||||
```
|
||||
|
||||
The resulting image should be available locally, named `ghcr.io/kyverno/kyverno` (by default, if `REGISTRY` environment variable was not set).
|
||||
|
||||
#### Building cli image locally
|
||||
|
||||
To build `cli` image on your local system, run:
|
||||
```console
|
||||
make docker-build-cli
|
||||
```
|
||||
|
||||
The resulting image should be available locally, named `ghcr.io/kyverno/kyverno-cli` (by default, if `REGISTRY` environment variable was not set).
|
||||
|
||||
### Building local images with ko
|
||||
|
||||
When building local images with ko you can't specify the registry used to create the image names. It will always be `ko.local`.
|
||||
|
||||
> **Note**: You can build all local images at once by running `make ko-build-all`.
|
||||
|
||||
#### Building kyvernopre image locally
|
||||
|
||||
To build `kyvernopre` image on your local system, run:
|
||||
```console
|
||||
make ko-build-kyvernopre
|
||||
```
|
||||
|
||||
The resulting image should be available locally, named `ko.local/github.com/kyverno/kyverno/cmd/initcontainer`.
|
||||
|
||||
#### Building kyverno image locally
|
||||
|
||||
To build `kyverno` image on your local system, run:
|
||||
```console
|
||||
make ko-build-kyverno
|
||||
```
|
||||
|
||||
The resulting image should be available locally, named `ko.local/github.com/kyverno/kyverno/cmd/kyverno`.
|
||||
|
||||
#### Building cli image locally
|
||||
|
||||
To build `cli` image on your local system, run:
|
||||
```console
|
||||
make ko-build-cli
|
||||
```
|
||||
|
||||
The resulting image should be available locally, named `ko.local/github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno`.
|
||||
|
||||
## Building and publishing an image locally
|
||||
|
||||
First, make sure you [install `ko`](https://github.com/google/ko#install)
|
||||
|
|
Loading…
Add table
Reference in a new issue