Skip to content

Commit adb1c65

Browse files
committed
fix: kcl arm64 docker image release
Signed-off-by: peefy <[email protected]>
1 parent 0496002 commit adb1c65

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

.github/workflows/release.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
uses: docker/build-push-action@v5
4343
with:
4444
context: .
45-
platforms: linux/amd64,linux/arm64
45+
platforms: linux/amd64
4646
push: ${{ github.event_name != 'pull_request' }}
4747
tags: ${{ steps.meta.outputs.tags }}
4848
labels: ${{ steps.meta.outputs.labels }}
@@ -76,6 +76,11 @@ jobs:
7676
username: ${{ secrets.DOCKER_USERNAME }}
7777
password: ${{ secrets.DOCKER_PASSWORD }}
7878

79+
- name: Edit arm64 arch for Dockerfile
80+
run: |
81+
sed -i 's/ubuntu:22.04/arm64v8\/ubuntu:20.04/g' Dockerfile
82+
echo "ENV KCL_FAST_EVAL=1" >> Dockerfile
83+
7984
- name: Extract metadata (tags, labels) for Docker
8085
id: meta
8186
uses: docker/metadata-action@v5
@@ -85,7 +90,7 @@ jobs:
8590
uses: docker/build-push-action@v5
8691
with:
8792
context: .
88-
platforms: linux/amd64,linux/arm64
93+
platforms: linux/arm64
8994
push: ${{ github.event_name != 'pull_request' }}
9095
tags: ${{ steps.meta.outputs.tags }}
9196
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
FROM --platform=${BUILDPLATFORM} golang:1.21 AS build
22
COPY / /src
33
WORKDIR /src
4-
RUN --mount=type=cache,target=/go/pkg --mount=type=cache,target=/root/.cache/go-build make build
4+
5+
# The TARGETOS and TARGETARCH args are set by docker. We set GOOS and GOARCH to
6+
# these values to ask Go to compile a binary for these architectures. If
7+
# TARGETOS and TARGETOS are different from BUILDPLATFORM, Go will cross compile
8+
# for us (e.g. compile a linux/amd64 binary on a linux/arm64 build machine).
9+
ARG TARGETOS
10+
ARG TARGETARCH
11+
12+
RUN --mount=type=cache,target=/go/pkg --mount=type=cache,target=/root/.cache/go-build GOOS=${TARGETOS} GOARCH=${TARGETARCH} make build
513

614
FROM --platform=${BUILDPLATFORM} ubuntu:22.04 AS base
715
ENV LANG=en_US.utf8

0 commit comments

Comments
 (0)