From adb4e46ecc91e86971bddae1f246bd404aef9e5f Mon Sep 17 00:00:00 2001 From: jasmingacic Date: Thu, 18 Aug 2022 13:18:34 +0000 Subject: [PATCH] added arm64 build support Signed-off-by: jasmingacic --- .github/workflows/release.yml | 4 +++- server/Dockerfile | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 64ce87a..11a7877 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,6 +48,7 @@ jobs: context: server file: server/Dockerfile push: true + platforms: linux/amd64,linux/arm64 tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} build-args: | @@ -73,7 +74,8 @@ jobs: ref: "main" fetch-depth: 0 token: ${{ secrets.CI_BOT_TOKEN }} - + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 - name: Install Helm uses: azure/setup-helm@v1 with: diff --git a/server/Dockerfile b/server/Dockerfile index ed410b4..da8e140 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.17 AS build +FROM --platform=$BUILDPLATFORM docker.io/golang:1.17 as builder WORKDIR /go/src # Copy `go.mod` for definitions and `go.sum` to invalidate the next layer # in case of a change in the dependencies @@ -7,11 +7,13 @@ COPY go.mod go.sum ./ RUN go mod download ARG TELEMETRY_TOKEN +ARG TARGETARCH +ARG TARGETOS COPY . . -RUN CGO_ENABLED=0 GOOS=linux go build -v -ldflags "-X github.com/kubeshop/kusk-gateway/pkg/analytics.TelemetryToken=$TELEMETRY_TOKEN" -o kusk-gateway-api +RUN RUN GOOS=$TARGETOS GOARCH=$TARGETARCH CGO_ENABLED=0 go build -v -ldflags "-X github.com/kubeshop/kusk-gateway/pkg/analytics.TelemetryToken=$TELEMETRY_TOKEN" -o kusk-gateway-api -FROM scratch AS runtime +FROM --platform=$BUILDPLATFORM gcr.io/distroless/static:nonroot COPY --from=build --chown=65532:65532 /go/src/kusk-gateway-api ./ EXPOSE 8080/tcp