From d1b4071e8cc59764b087b56498552ae67287867e Mon Sep 17 00:00:00 2001 From: Manu Garg Date: Wed, 1 Feb 2023 22:16:15 -0800 Subject: [PATCH] [docker] We don't need to copy ca certs anymore. --- Dockerfile | 13 ++++--------- Makefile | 6 +----- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index baf62493f4f..1b7d7e03f34 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,21 +8,16 @@ # This stage is used to find the correct binary for the platform. We store the # correct binary at /stage-0-workdir/cloudprober, and in the next stage discard # the rest. -FROM alpine AS stage0 -WORKDIR /stage-0-workdir +FROM alpine COPY cloudprober-linux-* ./ ARG TARGETPLATFORM RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ - mv cloudprober-linux-amd64 cloudprober; fi + mv cloudprober-linux-amd64 cloudprober && rm cloudprober-linux-*; fi RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \ - mv cloudprober-linux-arm64 cloudprober; fi + mv cloudprober-linux-arm64 cloudprober && rm cloudprober-linux-*; fi RUN if [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then \ - mv cloudprober-linux-armv7 cloudprober; fi - -FROM alpine -COPY ca-certificates.crt /etc/ssl/certs/ca-certificates.crt -COPY --from=stage0 /stage-0-workdir/cloudprober / + mv cloudprober-linux-armv7 cloudprober && rm cloudprober-linux-*; fi # Metadata params ARG BUILD_DATE diff --git a/Makefile b/Makefile index 46ab15ec76f..eaea8addf9f 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,6 @@ GIT_COMMIT = $(strip $(shell git rev-parse --short HEAD)) GOBIN ?= ${GOPATH}/bin BINARY ?= cloudprober DOCKER_IMAGE ?= cloudprober/cloudprober -CACERTS ?= /etc/ssl/certs/ca-certificates.crt SOURCES := $(shell find . -name '*.go') LDFLAGS ?= "-s -w -X main.version=$(VERSION) -X main.buildTimestamp=$(BUILD_DATE) -X main.dirty=$(DIRTY) -extldflags -static" BINARY_SOURCE ?= "./cmd/cloudprober.go" @@ -37,10 +36,7 @@ $(foreach bin,$(BINARIES),$(eval $(call make-binary-target,$(bin)))) $(BINARY): $(SOURCES) CGO_ENABLED=0 go build -o $@ -ldflags $(LDFLAGS) $(BINARY_SOURCE) -ca-certificates.crt: $(CACERTS) - cp $(CACERTS) ca-certificates.crt - -docker_multiarch: $(addprefix cloudprober-, $(LINUX_PLATFORMS)) ca-certificates.crt Dockerfile +docker_multiarch: $(addprefix cloudprober-, $(LINUX_PLATFORMS)) Dockerfile docker buildx build --push \ --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \ --build-arg VERSION=$(VERSION) \