Skip to content

Commit 23d062d

Browse files
Reduce operator image build temp usage
1 parent 283e396 commit 23d062d

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ COPY controllers/ controllers/
2323
COPY utils/ utils/
2424

2525
# Build
26-
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} GO111MODULE=on go build -a -o manager main.go
26+
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} GO111MODULE=on go build -p=2 -o manager main.go
2727

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

operator.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ COPY pkg/ pkg/
1717
COPY controllers/ controllers/
1818
COPY utils/ utils/
1919

20-
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} GO111MODULE=on go build -a -trimpath -o /workspace/manager main.go
20+
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} GO111MODULE=on go build -p=2 -trimpath -o /workspace/manager main.go
2121

2222
FROM alpine:3.21
2323

redhat.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ COPY controllers/ controllers/
2323
COPY utils/ utils/
2424

2525
# Build
26-
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} GO111MODULE=on go build -a -o manager main.go
26+
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} GO111MODULE=on go build -p=2 -o manager main.go
2727

2828
# Use ubi image as the base image which is required by the red hat certification.
2929
# Base on the image size, the order is ubi > ubi-minimal > ubi-micro.

0 commit comments

Comments
 (0)