From e03b3f25a5f24d52fe93cbf1ecf7def81b618fdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20S=C4=99k?= Date: Wed, 27 Jan 2021 14:29:05 +0100 Subject: [PATCH] Fix container-runtime-build Makefile goal --- Dockerfile | 8 +++++--- Makefile | 6 +++--- build/Dockerfile | 21 --------------------- pkg/event/event.go | 1 - 4 files changed, 8 insertions(+), 28 deletions(-) delete mode 100644 build/Dockerfile diff --git a/Dockerfile b/Dockerfile index da398ee5..ff840ea4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,8 @@ +ARG GO_VERSION + # Build the manager binary -FROM golang:1.15 as builder +FROM golang:$GO_VERSION as builder +ARG CTIMEVAR WORKDIR /workspace # Copy the Go Modules manifests @@ -18,8 +21,7 @@ COPY version/ version/ COPY main.go main.go # Build -# FIXME look at makefile build -RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -ldflags "-w $CTIMEVAR" -o manager main.go # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details diff --git a/Makefile b/Makefile index 4529758e..8abf5581 100644 --- a/Makefile +++ b/Makefile @@ -201,13 +201,13 @@ container-runtime-login: ## Log in into the Docker repository @echo "+ $@" .PHONY: container-runtime-build -container-runtime-build: check-env ## Build the container +container-runtime-build: check-env deepcopy-gen ## Build the container @echo "+ $@" $(CONTAINER_RUNTIME_COMMAND) build \ --build-arg GO_VERSION=$(GO_VERSION) \ - --build-arg OPERATOR_SDK_VERSION=$(OPERATOR_SDK_VERSION) \ + --build-arg CTIMEVAR="$(CTIMEVAR)" \ -t $(DOCKER_REGISTRY):$(GITCOMMIT) . \ - --file build/Dockerfile $(CONTAINER_RUNTIME_EXTRA_ARGS) + --file Dockerfile $(CONTAINER_RUNTIME_EXTRA_ARGS) .PHONY: container-runtime-images container-runtime-images: ## List all local containers diff --git a/build/Dockerfile b/build/Dockerfile deleted file mode 100644 index 1615bd64..00000000 --- a/build/Dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -ARG GO_VERSION - -# build stage -FROM golang:$GO_VERSION-alpine3.11 AS build-stage -ARG OPERATOR_SDK_VERSION -ENV GO111MODULE=on -RUN apk --no-cache add git curl make \ - && curl -L https://github.com/operator-framework/operator-sdk/releases/download/v$OPERATOR_SDK_VERSION/operator-sdk-v$OPERATOR_SDK_VERSION-x86_64-linux-gnu -o /usr/local/bin/operator-sdk \ - && chmod +x /usr/local/bin/operator-sdk -ADD . /kubernetes-operator - -RUN cd /kubernetes-operator && make build - -# run stage -FROM alpine:3.10 - -USER nobody - -COPY --from=build-stage /kubernetes-operator/build/_output/bin/jenkins-operator /usr/local/bin/jenkins-operator - -CMD [ "/usr/local/bin/jenkins-operator" ] diff --git a/pkg/event/event.go b/pkg/event/event.go index ca0a9e0a..ce0713eb 100644 --- a/pkg/event/event.go +++ b/pkg/event/event.go @@ -54,7 +54,6 @@ func initializeEventRecorder(config *rest.Config, component string) (record.Even return nil, errors.WithStack(err) } eventBroadcaster := record.NewBroadcaster() - //eventBroadcaster.StartLogging(glog.Infof) TODO integrate with proper logger eventBroadcaster.StartRecordingToSink( &typedcorev1.EventSinkImpl{ Interface: client.CoreV1().Events("")})