Skip to content

Commit d35f387

Browse files
authored
feat: Speed up the building process of API Server image (#124)
1 parent 329dc4a commit d35f387

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/apiserver/Dockerfile

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.23.2 as builder
1+
FROM --platform=$BUILDPLATFORM golang:1.23.2 as builder
22

33
ARG GOPROXY
44
ENV GOPROXY=${GOPROXY}
@@ -8,9 +8,12 @@ WORKDIR /workspace
88
# Copy the go source
99
COPY . ./
1010

11+
ARG TARGETOS
12+
ARG TARGETARCH
13+
1114
# Build
1215
RUN go mod tidy
13-
RUN CGO_ENABLED=0 GOOS=linux go build -a -o apiserver main.go
16+
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -a -o apiserver main.go
1417

1518
# Use distroless as minimal base image to package the manager binary
1619
# Refer to https://github.com/GoogleContainerTools/distroless for more details

0 commit comments

Comments
 (0)