File tree Expand file tree Collapse file tree 3 files changed +15
-9
lines changed Expand file tree Collapse file tree 3 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ WORKDIR /workspace
55# Copy the Go Modules manifests
66COPY go.mod go.mod
77COPY go.sum go.sum
8+ COPY ./Makefile ./Makefile
89RUN go mod download
910
1011# Copy the Go sources
@@ -13,7 +14,7 @@ COPY pkg/ pkg/
1314
1415# Build
1516USER 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
1819FROM registry.access.redhat.com/ubi8/ubi-minimal:8.8
1920WORKDIR /
Original file line number Diff line number Diff 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
159168run : manifests fmt vet # # Run a controller from your host.
160169 go run ./main.go
Original file line number Diff line number Diff line change @@ -56,12 +56,10 @@ import (
5656)
5757
5858var (
59- scheme = runtime .NewScheme ()
60- setupLog = ctrl .Log .WithName ("setup" )
61- OperatorVersion = "UNKNOWN"
62- McadVersion = "UNKNOWN"
63- InstaScaleVersion = "UNKNOWN"
64- BuildDate = "UNKNOWN"
59+ scheme = runtime .NewScheme ()
60+ setupLog = ctrl .Log .WithName ("setup" )
61+ OperatorVersion = "UNKNOWN"
62+ BuildDate = "UNKNOWN"
6563)
6664
6765func init () {
@@ -90,8 +88,6 @@ func main() {
9088
9189 setupLog .Info ("Build info" ,
9290 "operatorVersion" , OperatorVersion ,
93- "mcadVersion" , McadVersion ,
94- "instaScaleVersion" , InstaScaleVersion ,
9591 "date" , BuildDate ,
9692 )
9793
You can’t perform that action at this time.
0 commit comments