File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change 1
1
2
2
# Image URL to use all building/pushing image targets
3
3
IMG ?= controller:latest
4
+ SIDECAR_IMG ?= quay.io/csiaddons/k8s-sidecar
5
+ TAG? = latest
4
6
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
5
7
ENVTEST_K8S_VERSION = 1.23
6
8
@@ -77,6 +79,14 @@ docker-build: test ## Build docker image with the manager.
77
79
docker-push : # # Push docker image with the manager.
78
80
docker push ${IMG}
79
81
82
+ .PHONY : docker-build-sidecar
83
+ docker-build-sidecar :
84
+ docker build -f ./build/Containerfile.sidecar -t ${SIDECAR_IMG} :${TAG} .
85
+
86
+ .PHONY : docker-push-sidecar
87
+ docker-push-sidecar :
88
+ docker push ${SIDECAR_IMG} :${TAG}
89
+
80
90
# #@ Deployment
81
91
82
92
ifndef ignore-not-found
Original file line number Diff line number Diff line change
1
+ # Build the sidecar binary
2
+ FROM golang:1.17 as builder
3
+
4
+ WORKDIR /workspace
5
+ # Copy the Go Modules manifests
6
+ COPY go.mod go.mod
7
+ COPY go.sum go.sum
8
+ # cache deps before building and copying source so that we don't need to re-download as much
9
+ # and so that source changes don't invalidate our downloaded layer
10
+ RUN go mod download
11
+
12
+ # Copy the go source
13
+ COPY sidecar/ sidecar/
14
+ COPY api/ api/
15
+ COPY internal/ internal/
16
+
17
+ # Build
18
+ RUN CGO_ENABLED=0 GOOS=linux go build -a -o csi-addons-sidecar sidecar/main.go
19
+
20
+ # Use distroless as minimal base image to package the sidecar binary
21
+ # Refer to https://github.com/GoogleContainerTools/distroless for more details
22
+ FROM gcr.io/distroless/static:latest
23
+ WORKDIR /
24
+ COPY --from=builder /workspace/csi-addons-sidecar /usr/bin/
25
+
26
+ ENTRYPOINT ["/usr/bin/csi-addons-sidecar"]
You can’t perform that action at this time.
0 commit comments