Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
COPY ./Makefile ./Makefile
RUN go mod download

# Copy the Go sources
Expand All @@ -13,7 +14,7 @@ COPY pkg/ pkg/

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

FROM registry.access.redhat.com/ubi8/ubi-minimal:8.8
WORKDIR /
Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,15 @@ build: fmt vet ## Build manager binary.
" \
-o bin/manager main.go

.PHONY: go-build-for-image
go-build-for-image: fmt vet ## Build manager binary.
go build \
-ldflags " \
-X 'main.OperatorVersion=$(BUILD_VERSION)' \
-X 'main.BuildDate=$(BUILD_DATE)' \
" \
-tags strictfipsruntime -a -o manager main.go

.PHONY: run
run: manifests fmt vet ## Run a controller from your host.
go run ./main.go
Expand Down
12 changes: 4 additions & 8 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,10 @@ import (
)

var (
scheme = runtime.NewScheme()
setupLog = ctrl.Log.WithName("setup")
OperatorVersion = "UNKNOWN"
McadVersion = "UNKNOWN"
InstaScaleVersion = "UNKNOWN"
BuildDate = "UNKNOWN"
scheme = runtime.NewScheme()
setupLog = ctrl.Log.WithName("setup")
OperatorVersion = "UNKNOWN"
BuildDate = "UNKNOWN"
)

func init() {
Expand Down Expand Up @@ -90,8 +88,6 @@ func main() {

setupLog.Info("Build info",
"operatorVersion", OperatorVersion,
"mcadVersion", McadVersion,
"instaScaleVersion", InstaScaleVersion,
"date", BuildDate,
)

Expand Down