diff --git a/cmd/thv-operator/Taskfile.yml b/cmd/thv-operator/Taskfile.yml index 0e4e856cc..f72da810e 100644 --- a/cmd/thv-operator/Taskfile.yml +++ b/cmd/thv-operator/Taskfile.yml @@ -364,9 +364,11 @@ tasks: SHA: sh: git rev-parse HEAD || echo "unknown" REPO: '{{.REPO | default "ghcr.io/stacklok/toolhive"}}' + PLATFORM: + sh: echo "${PLATFORM:-linux/$(go env GOARCH)}" cmds: - > - eval "{{.CONTAINER_RUNTIME}} build --load + eval "{{.CONTAINER_RUNTIME}} build --platform={{.PLATFORM}} --load -t {{.REPO}}/thv-operator:{{.SHA}}-ubi --build-arg CODEDIR=cmd/thv-operator --build-arg VERSION={{.SHA}}-ubi @@ -386,9 +388,11 @@ tasks: SHA: sh: git rev-parse HEAD || echo "unknown" REPO: '{{.REPO | default "ghcr.io/stacklok/toolhive"}}' + PLATFORM: + sh: echo "${PLATFORM:-linux/$(go env GOARCH)}" cmds: - > - eval "{{.CONTAINER_RUNTIME}} build --load + eval "{{.CONTAINER_RUNTIME}} build --platform={{.PLATFORM}} --load -t {{.REPO}}/thv-proxyrunner:{{.SHA}}-ubi --build-arg CODEDIR=cmd/thv-proxyrunner --build-arg VERSION={{.SHA}}-ubi diff --git a/containers/operator/Dockerfile b/containers/operator/Dockerfile index 333bc0645..6110ce676 100644 --- a/containers/operator/Dockerfile +++ b/containers/operator/Dockerfile @@ -26,10 +26,10 @@ RUN CGO_ENABLED=0 LDFLAGS="-s -w \ -X github.com/stacklok/toolhive/pkg/versions.Commit=${COMMIT} \ -X github.com/stacklok/toolhive/pkg/versions.BuildDate=${BUILD_DATE} \ -X github.com/stacklok/toolhive/pkg/versions.BuildType=release" \ -GOOS=linux GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o main ./${CODEDIR}/main.go +go build -ldflags "${LDFLAGS}" -o main ./${CODEDIR}/main.go -# Use micro base image to package the binary -FROM --platform=linux/amd64 registry.access.redhat.com/ubi10/ubi-minimal:10.1-1763362715 +# Use minimal base image to package the binary +FROM registry.access.redhat.com/ubi10/ubi-minimal:10.1-1763362715 COPY --from=builder /workspace/main / COPY LICENSE /licenses/LICENSE