1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 21:46:22 +01:00
Files
openshift-docs/modules/osdk-cli-reference-build.adoc
2019-03-19 08:21:41 -04:00

62 lines
1.7 KiB
Plaintext

[id="osdk-cli-reference-build-{context}"]
= build
The `operator-sdk build` command compiles the code and builds the executables.
After `build` completes, the image is built locally in `docker`. It must then be
pushed to a remote registry.
.`build` arguments
[options="header",cols="1,3"]
|===
|Argument |Description
|`<image>`
|The container image to be built, e.g., `quay.io/example/operator:v0.0.1`.
|===
.`build` flags
[options="header",cols="1,3"]
|===
|Flag |Description
|`--enable-tests` (bool)
|Enable in-cluster testing by adding test binary to the image.
|`--namespaced-manifest` (string)
|Path of namespaced resources manifest for tests. Default: `deploy/operator.yaml`.
|`--test-location` (string)
|Location of tests. Default: `./test/e2e`
|`-h, --help`
|Usage help output.
|===
If `--enable-tests` is set, the `build` command also builds the testing binary,
adds it to the container image, and generates a `deploy/test-pod.yaml` file that
allows a user to run the tests as a Pod on a cluster.
.Example output
----
$ operator-sdk build quay.io/example/operator:v0.0.1
building example-operator...
building container quay.io/example/operator:v0.0.1...
Sending build context to Docker daemon 163.9MB
Step 1/4 : FROM alpine:3.6
---> 77144d8c6bdc
Step 2/4 : ADD tmp/_output/bin/example-operator /usr/local/bin/example-operator
---> 2ada0d6ca93c
Step 3/4 : RUN adduser -D example-operator
---> Running in 34b4bb507c14
Removing intermediate container 34b4bb507c14
---> c671ec1cff03
Step 4/4 : USER example-operator
---> Running in bd336926317c
Removing intermediate container bd336926317c
---> d6b58a0fcb8c
Successfully built d6b58a0fcb8c
Successfully tagged quay.io/example/operator:v0.0.1
----