Skip to content

Commit

Permalink
Merge pull request #1462 from wilsonwu/main
Browse files Browse the repository at this point in the history
Add Docker image support multi OS archs
  • Loading branch information
k8s-ci-robot authored Nov 9, 2022
2 parents fa2063e + d011951 commit 9568c67
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM golang:1.18 AS build-env
ARG BUILDPLATFORM=linux/amd64
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
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,3 @@ Participation in the Kubernetes community is governed by the
[spec]: https://gateway-api.sigs.k8s.io/v1alpha2/references/spec
[concepts]: https://gateway-api.sigs.k8s.io/concepts/api-overview
[security-model]: https://gateway-api.sigs.k8s.io/concepts/security-model

13 changes: 6 additions & 7 deletions hack/build-and-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,9 @@ fi

# First, build the image, with the version info passed in.
# Note that an image will *always* be built tagged with the GIT_TAG, so we know when it was built.
docker build --build-arg COMMIT=${COMMIT} --build-arg TAG=${BINARY_TAG} \
-t ${REGISTRY}/admission-server:${GIT_TAG} .
docker push ${REGISTRY}/admission-server:${GIT_TAG}

# Then, we add an extra version tag - either :latest or semver.
docker tag ${REGISTRY}/admission-server:${GIT_TAG} ${REGISTRY}/admission-server:${VERSION_TAG}
docker push ${REGISTRY}/admission-server:${VERSION_TAG}
# And, we add an extra version tag - either :latest or semver.
# The buildx integrate build and push in one line.
docker buildx build --build-arg COMMIT=${COMMIT} --build-arg TAG=${BINARY_TAG} \
-t ${REGISTRY}/admission-server:${GIT_TAG} \
-t ${REGISTRY}/admission-server:${VERSION_TAG} \
. --platform linux/amd64,linux/arm64 --push

0 comments on commit 9568c67

Please sign in to comment.