diff --git a/Dockerfile b/Dockerfile index eaa859a9b1..c8c45437cc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,13 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM golang:1.18 AS build-env +FROM --platform=$BUILDPLATFORM golang:1.18 AS build-env RUN mkdir -p /go/src/sig.k8s.io/gateway-api WORKDIR /go/src/sig.k8s.io/gateway-api COPY . . +ARG TARGETARCH ARG TAG ARG COMMIT -RUN CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -a -o gateway-api-webhook \ +RUN CGO_ENABLED=0 GOARCH=$TARGETARCH GOOS=linux go build -a -o gateway-api-webhook \ -ldflags "-s -w -X main.VERSION=$TAG -X main.COMMIT=$COMMIT" ./cmd/admission FROM gcr.io/distroless/static:nonroot diff --git a/README.md b/README.md index 2bb66e2130..65213c5137 100644 --- a/README.md +++ b/README.md @@ -68,3 +68,10 @@ Participation in the Kubernetes community is governed by the [concepts]: https://gateway-api.sigs.k8s.io/concepts/api-overview [security-model]: https://gateway-api.sigs.k8s.io/concepts/security-model + +## ARM Image Support + +Use buildx for image building to support both amd64 and arm64: +``` +docker buildx build -f Dockerfile -t registry/admission-server:tag . --platform linux/amd64,linux/arm64 +```