Skip to content

Commit

Permalink
Add docker image support both amd64 and arm64 with doc update
Browse files Browse the repository at this point in the history
  • Loading branch information
wilsonwu committed Oct 18, 2022
1 parent bb714e0 commit 3d1809c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

0 comments on commit 3d1809c

Please sign in to comment.