Skip to content

Commit 644614a

Browse files
authored
Merge pull request #2 from vlsi/fix_go_build_arch
chore: use proper GOOS and GOARCH for go build rather than static linux/amd64
2 parents 4d3101e + d9cb2ee commit 644614a

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

.github/workflows/push.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
no-cache: true
4747
context: ${{ matrix.component.context }}
4848
file: ${{ matrix.component.file }}
49-
platforms: linux/amd64
49+
platforms: linux/amd64,linux/arm64
5050
push: true
5151
tags: ghcr.io/netcracker/${{ matrix.component.name }}:${{ env.TAG_NAME }}
5252
provenance: false

Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
FROM docker.io/golang:1.23.4-alpine3.21 as builder
1+
# Note: this uses host platform for the build, and we ask go build to target the needed platform, so we do not spend time on qemu emulation when running "go build"
2+
FROM --platform=$BUILDPLATFORM docker.io/golang:1.23.4-alpine3.21 as builder
3+
ARG BUILDPLATFORM
4+
ARG TARGETOS
5+
ARG TARGETARCH
26

37
WORKDIR /workspace
48

59
COPY qubership-apihub-service qubership-apihub-service
610

711
WORKDIR /workspace/qubership-apihub-service
812

9-
RUN set GOSUMDB=off && set CGO_ENABLED=0 && set GOOS=linux && go mod tidy && go mod download && go build .
13+
RUN set GOSUMDB=off && set CGO_ENABLED=0 && go mod tidy && go mod download && go GOOS=${TARGETOS} GOARCH=${TARGETARCH} build .
1014

1115
FROM docker.io/golang:1.23.4-alpine3.21
1216

0 commit comments

Comments
 (0)