From 825c3303f77970b50a93b88c4b4261ea89d2dbd0 Mon Sep 17 00:00:00 2001 From: Kshitija Kakde Date: Wed, 17 Jan 2024 12:23:39 +0530 Subject: [PATCH 1/6] modified dockerfile --- Dockerfile | 27 +++++++++++++++++++++------ docker.mk | 2 +- overrides.mk | 6 ++++++ 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 660de4c..1060db9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,28 @@ ARG BASEIMAGE +ARG GOVERSION -FROM $BASEIMAGE AS final -COPY ./bin/vg-snapshotter . -ENTRYPOINT ["/vg-snapshotter"] +FROM golang:${GOVERSION} as builder +RUN mkdir -p /go/src +COPY ./ /go/src/ +WORKDIR /go/src/ +RUN CGO_ENABLED=0 \ + make build + +# Final Stage +FROM $BASEIMAGE AS final + +# Copy the binary from the builder stage + +COPY --from=builder /go/src/bin/vg-snapshotter . + +# Set entry point +ENTRYPOINT ["/go/src/bin/vg-snapshotter"] + +# Metadata labels LABEL vendor="Dell Inc." \ name="dellcsi-vg-snapshotter" \ - summary="CSI VG Snapshotter for Dell EMC Powerflex" \ + summary="CSI VG Snapshotter for Dell EMC PowerFlex" \ description="Dell Storage VolumeGroup Snapshot Controller for CSI" \ version="1.4.0" \ - license="Apache-2.0" - + license="Apache-2.0" \ No newline at end of file diff --git a/docker.mk b/docker.mk index 444dafe..8ae59e7 100644 --- a/docker.mk +++ b/docker.mk @@ -8,7 +8,7 @@ endif docker: @echo "Base Images is set to: $(BASEIMAGE)" @echo "Building: $(REGISTRY)/$(IMAGENAME):$(IMAGETAG)" - $(BUILDER) build -t "$(REGISTRY)/$(IMAGENAME):$(IMAGETAG)" --target $(BUILDSTAGE) --build-arg BASEIMAGE=$(BASEIMAGE) . + $(BUILDER) build -t "$(REGISTRY)/$(IMAGENAME):$(IMAGETAG)" --target $(BUILDSTAGE) --build-arg BASEIMAGE=$(BASEIMAGE) --build-arg GOVERSION=$(GOVERSION) push: @echo "Pushing: $(REGISTRY)/$(IMAGENAME):$(IMAGETAG)" diff --git a/overrides.mk b/overrides.mk index 8e82018..4a2ab72 100644 --- a/overrides.mk +++ b/overrides.mk @@ -7,12 +7,18 @@ DEFAULT_REGISTRY="dellemc" DEFAULT_IMAGENAME="csi-volumegroup-snapshotter" DEFAULT_BUILDSTAGE="final" DEFAULT_IMAGETAG="1.4.0" +DEFAULT_GOVERSION="1.21" # set the REGISTRY if needed ifeq ($(REGISTRY),) export REGISTRY="$(DEFAULT_REGISTRY)" endif +# set the GOVERSION if needed +ifeq ($(GOVERSION),) +export GOVERSION="$(DEFAULT_GOVERSION)" +endif + # set the IMAGENAME if needed ifeq ($(IMAGENAME),) export IMAGENAME="$(DEFAULT_IMAGENAME)" From 3b65baba58143a6e8d05ec57dded7515ef588761 Mon Sep 17 00:00:00 2001 From: Kshitija Kakde Date: Wed, 17 Jan 2024 13:20:44 +0530 Subject: [PATCH 2/6] modified dockerfile --- docker.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker.mk b/docker.mk index 8ae59e7..664af8b 100644 --- a/docker.mk +++ b/docker.mk @@ -8,7 +8,7 @@ endif docker: @echo "Base Images is set to: $(BASEIMAGE)" @echo "Building: $(REGISTRY)/$(IMAGENAME):$(IMAGETAG)" - $(BUILDER) build -t "$(REGISTRY)/$(IMAGENAME):$(IMAGETAG)" --target $(BUILDSTAGE) --build-arg BASEIMAGE=$(BASEIMAGE) --build-arg GOVERSION=$(GOVERSION) + $(BUILDER) build -t "$(REGISTRY)/$(IMAGENAME):$(IMAGETAG)" --target $(BUILDSTAGE) --build-arg BASEIMAGE=$(BASEIMAGE) --build-arg GOVERSION=$(GOVERSION) . push: @echo "Pushing: $(REGISTRY)/$(IMAGENAME):$(IMAGETAG)" From bc29fc453d00270642badadce3d9f671dc84252d Mon Sep 17 00:00:00 2001 From: Kshitija Kakde Date: Wed, 17 Jan 2024 15:54:17 +0530 Subject: [PATCH 3/6] modified dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 1060db9..b58f04e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,7 @@ FROM $BASEIMAGE AS final COPY --from=builder /go/src/bin/vg-snapshotter . # Set entry point -ENTRYPOINT ["/go/src/bin/vg-snapshotter"] +ENTRYPOINT ["/vg-snapshotter"] # Metadata labels LABEL vendor="Dell Inc." \ From 101045e2ede603bf8df2ad7dc9b38232b5b6aef3 Mon Sep 17 00:00:00 2001 From: KshitijaKakde <111420075+KshitijaKakde@users.noreply.github.com> Date: Mon, 22 Jan 2024 14:38:05 +0530 Subject: [PATCH 4/6] Update docker.mk --- docker.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker.mk b/docker.mk index 664af8b..0dbc81f 100644 --- a/docker.mk +++ b/docker.mk @@ -8,7 +8,7 @@ endif docker: @echo "Base Images is set to: $(BASEIMAGE)" @echo "Building: $(REGISTRY)/$(IMAGENAME):$(IMAGETAG)" - $(BUILDER) build -t "$(REGISTRY)/$(IMAGENAME):$(IMAGETAG)" --target $(BUILDSTAGE) --build-arg BASEIMAGE=$(BASEIMAGE) --build-arg GOVERSION=$(GOVERSION) . + $(BUILDER) build -t "$(REGISTRY)/$(IMAGENAME):$(IMAGETAG)" --target $(BUILDSTAGE) --build-arg BASEIMAGE=$(BASEIMAGE) --build-arg GOVERSION=$(GOVERSION) . push: @echo "Pushing: $(REGISTRY)/$(IMAGENAME):$(IMAGETAG)" From c55c984f245503706693c49d5e4b918d012eaffa Mon Sep 17 00:00:00 2001 From: Kshitija Kakde Date: Mon, 22 Jan 2024 17:44:25 +0530 Subject: [PATCH 5/6] review comments addressed --- Dockerfile | 2 +- overrides.mk | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b58f04e..c2cad0d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,7 +22,7 @@ ENTRYPOINT ["/vg-snapshotter"] # Metadata labels LABEL vendor="Dell Inc." \ name="dellcsi-vg-snapshotter" \ - summary="CSI VG Snapshotter for Dell EMC PowerFlex" \ + summary="CSI VG Snapshotter for Dell EMC PowerFlex/PowerStore" \ description="Dell Storage VolumeGroup Snapshot Controller for CSI" \ version="1.4.0" \ license="Apache-2.0" \ No newline at end of file diff --git a/overrides.mk b/overrides.mk index 4a2ab72..5e9176e 100644 --- a/overrides.mk +++ b/overrides.mk @@ -54,5 +54,7 @@ overrides-help: @echo "BUILDSTAGE - The Dockerfile build stage to execute, default is: $(DEFAULT_BUILDSTAGE)" @echo " Stages can be found by looking at the Dockerfile" @echo " Current setting is: $(BUILDSTAGE)" + @echo "GOVERSION - The version of Go to build with, default is: $(DEFAULT_GOVERSION)" + @echo " Current setting is: $(GOVERSION)"" @echo From d4868d308d7339c440eba51391b1554372e211ca Mon Sep 17 00:00:00 2001 From: Kshitija Kakde Date: Tue, 23 Jan 2024 15:04:22 +0530 Subject: [PATCH 6/6] review comments addressed --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d5ed2b4..c677ee5 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,7 @@ else GOBIN=$(shell go env GOBIN) endif -all: build +all: help ##@ General