Skip to content

Commit 86f6323

Browse files
committed
Add configurable multi-arch build support
Signed-off-by: Catherine Chan-Tse <[email protected]>
1 parent 0eed476 commit 86f6323

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

Diff for: docs/tutorial.md

+11-6
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ The `java-operator-plugins` project uses the APIs from [java-operator-sdk](https
8787

8888
#### `MemcachedSpec`
8989

90-
Initially, the scaffolded Spec file will be empty. The operator developer needs
90+
Initially, the scaffolded Spec file, `MemcachedSpec`, will be empty. The operator developer needs
9191
to add attributes to this file according to their needs. For the `Memcached`
9292
example, we will add the size field as shown in the example below.
9393

@@ -564,15 +564,20 @@ The following steps will show how to run your operator in the cluster.
564564

565565
The `java-operator-plugins` project will scaffold out a Makefile to give
566566
Operator SDK users a familiar interface. Using the `docker-*` targets you can
567-
conveniently build your and push your operator's image to registry. In our
568-
example, we are using `quay.io`, but any docker registry should work.
567+
conveniently build and push your operator's image to a registry.
568+
569+
To build and push the docker image, you will need to specify the name of the image, `IMG`,
570+
that will be built as well as the operating system, `OS`, and the architecture,
571+
`ARCH`, that the image will be built for. In this example, we are using
572+
`quay.io` as the registry the image will be pushed to, but any docker registry should work.
569573

570574
```
571-
make docker-build docker-push IMG=quay.io/YOURUSER/memcached-quarkus-operator:v0.0.1
575+
make docker-build docker-push IMG=quay.io/YOURUSER/memcached-quarkus-operator:v0.0.1 OS=linux ARCH=arm64
572576
```
573577

574-
This will build the docker image
575-
`quay.io/YOURUSER/memcached-quarkus-operator:v0.0.1` and push it to the registry.
578+
This will build the docker image
579+
`quay.io/YOURUSER/memcached-quarkus-operator:v0.0.1` for linux/arm64 and push it
580+
to the `quay.io` registry.
576581

577582
You can verify it is in your docker registry:
578583

Diff for: pkg/quarkus/v1alpha/scaffolds/internal/templates/makefile.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,11 @@ func (f *Makefile) SetTemplateDefaults() error {
6262
}
6363

6464
const makefileTemplate = `
65-
# Image URL to use all building/pushing image targets
65+
# Image URL to use for all building/pushing image targets
6666
IMG ?= {{ .Image }}
67+
# Operating system and architecture to use for building image
68+
OS ?= {{ .OS }}
69+
ARCH ?= {{ .Arch }}
6770
6871
all: docker-build
6972
@@ -86,7 +89,7 @@ help: ## Display this help.
8689
##@ Build
8790
8891
docker-build: ## Build docker image with the manager.
89-
mvn package -Dquarkus.container-image.build=true -Dquarkus.container-image.image=${IMG}
92+
mvn package -Dquarkus.container-image.build=true -Dquarkus.container-image.builder=docker -Dquarkus.container-image.image=${IMG} -Dquarkus.docker.buildx.platform=${OS}/${ARCH}
9093
9194
docker-push: ## Push docker image with the manager.
9295
mvn package -Dquarkus.container-image.push=true -Dquarkus.container-image.image=${IMG}

0 commit comments

Comments
 (0)