Skip to content

Commit 4606269

Browse files
Fix Unknown build info in CodeFlare operator log
1 parent 12b72cb commit 4606269

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ WORKDIR /workspace
55
# Copy the Go Modules manifests
66
COPY go.mod go.mod
77
COPY go.sum go.sum
8+
COPY ./Makefile ./Makefile
89
RUN go mod download
910

1011
# Copy the Go sources
@@ -13,7 +14,7 @@ COPY pkg/ pkg/
1314

1415
# Build
1516
USER root
16-
RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -tags strictfipsruntime -a -o manager main.go
17+
RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 make go-build-for-image
1718

1819
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.8
1920
WORKDIR /

Makefile

+9
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,15 @@ build: fmt vet ## Build manager binary.
155155
" \
156156
-o bin/manager main.go
157157

158+
.PHONY: go-build-for-image
159+
go-build-for-image: fmt vet ## Build manager binary.
160+
go build \
161+
-ldflags " \
162+
-X 'main.OperatorVersion=$(BUILD_VERSION)' \
163+
-X 'main.BuildDate=$(BUILD_DATE)' \
164+
" \
165+
-tags strictfipsruntime -a -o manager main.go
166+
158167
.PHONY: run
159168
run: manifests fmt vet ## Run a controller from your host.
160169
go run ./main.go

0 commit comments

Comments
 (0)