Fix container-runtime-build Makefile goal
This commit is contained in:
parent
53961d7bde
commit
e03b3f25a5
|
|
@ -1,5 +1,8 @@
|
||||||
|
ARG GO_VERSION
|
||||||
|
|
||||||
# Build the manager binary
|
# Build the manager binary
|
||||||
FROM golang:1.15 as builder
|
FROM golang:$GO_VERSION as builder
|
||||||
|
ARG CTIMEVAR
|
||||||
|
|
||||||
WORKDIR /workspace
|
WORKDIR /workspace
|
||||||
# Copy the Go Modules manifests
|
# Copy the Go Modules manifests
|
||||||
|
|
@ -18,8 +21,7 @@ COPY version/ version/
|
||||||
COPY main.go main.go
|
COPY main.go main.go
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
# FIXME look at makefile build
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -ldflags "-w $CTIMEVAR" -o manager main.go
|
||||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go
|
|
||||||
|
|
||||||
# Use distroless as minimal base image to package the manager binary
|
# Use distroless as minimal base image to package the manager binary
|
||||||
# Refer to https://github.com/GoogleContainerTools/distroless for more details
|
# Refer to https://github.com/GoogleContainerTools/distroless for more details
|
||||||
|
|
|
||||||
6
Makefile
6
Makefile
|
|
@ -201,13 +201,13 @@ container-runtime-login: ## Log in into the Docker repository
|
||||||
@echo "+ $@"
|
@echo "+ $@"
|
||||||
|
|
||||||
.PHONY: container-runtime-build
|
.PHONY: container-runtime-build
|
||||||
container-runtime-build: check-env ## Build the container
|
container-runtime-build: check-env deepcopy-gen ## Build the container
|
||||||
@echo "+ $@"
|
@echo "+ $@"
|
||||||
$(CONTAINER_RUNTIME_COMMAND) build \
|
$(CONTAINER_RUNTIME_COMMAND) build \
|
||||||
--build-arg GO_VERSION=$(GO_VERSION) \
|
--build-arg GO_VERSION=$(GO_VERSION) \
|
||||||
--build-arg OPERATOR_SDK_VERSION=$(OPERATOR_SDK_VERSION) \
|
--build-arg CTIMEVAR="$(CTIMEVAR)" \
|
||||||
-t $(DOCKER_REGISTRY):$(GITCOMMIT) . \
|
-t $(DOCKER_REGISTRY):$(GITCOMMIT) . \
|
||||||
--file build/Dockerfile $(CONTAINER_RUNTIME_EXTRA_ARGS)
|
--file Dockerfile $(CONTAINER_RUNTIME_EXTRA_ARGS)
|
||||||
|
|
||||||
.PHONY: container-runtime-images
|
.PHONY: container-runtime-images
|
||||||
container-runtime-images: ## List all local containers
|
container-runtime-images: ## List all local containers
|
||||||
|
|
|
||||||
|
|
@ -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" ]
|
|
||||||
|
|
@ -54,7 +54,6 @@ func initializeEventRecorder(config *rest.Config, component string) (record.Even
|
||||||
return nil, errors.WithStack(err)
|
return nil, errors.WithStack(err)
|
||||||
}
|
}
|
||||||
eventBroadcaster := record.NewBroadcaster()
|
eventBroadcaster := record.NewBroadcaster()
|
||||||
//eventBroadcaster.StartLogging(glog.Infof) TODO integrate with proper logger
|
|
||||||
eventBroadcaster.StartRecordingToSink(
|
eventBroadcaster.StartRecordingToSink(
|
||||||
&typedcorev1.EventSinkImpl{
|
&typedcorev1.EventSinkImpl{
|
||||||
Interface: client.CoreV1().Events("")})
|
Interface: client.CoreV1().Events("")})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue