File tree 5 files changed +87
-1
lines changed
5 files changed +87
-1
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ ENV LIB_DIR_PREFIX x86_64
40
40
FROM distroless-base AS distroless-arm64
41
41
ENV LIB_DIR_PREFIX aarch64
42
42
43
- FROM distroless-$TARGETARCH
43
+ FROM distroless-$TARGETARCH as output-image
44
44
45
45
# Copy necessary dependencies into distroless base.
46
46
COPY --from=builder /go/src/sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/bin/gce-pd-csi-driver /gce-pd-csi-driver
@@ -98,4 +98,16 @@ COPY --from=debian /usr/lib/${LIB_DIR_PREFIX}-linux-gnu/libacl.so.1 \
98
98
# Copy NVME support required script and rules into distroless base.
99
99
COPY deploy/kubernetes/udev/google_nvme_id /lib/udev_containerized/google_nvme_id
100
100
101
+ # Build stage used for validation of the output-image
102
+ # See validate-container-linux-* targets in Makefile
103
+ FROM output-image as validation-image
104
+
105
+ COPY --from=debian /usr/bin/ldd /usr/bin/find /usr/bin/xargs /usr/bin/
106
+ COPY --from=builder /go/src/sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/hack/print-missing-deps.sh /print-missing-deps.sh
107
+ SHELL ["/bin/bash" , "-c" ]
108
+ RUN /print-missing-deps.sh
109
+
110
+ # Final build stage, create the real Docker image with ENTRYPOINT
111
+ FROM output-image
112
+
101
113
ENTRYPOINT ["/gce-pd-csi-driver" ]
Original file line number Diff line number Diff line change @@ -79,6 +79,22 @@ build-and-push-multi-arch-debug: build-and-push-container-linux-debug build-and-
79
79
80
80
push-container : build-container
81
81
82
+ # Used by hack/verify-docker-deps.sh, not used for building artifacts
83
+ validate-container-linux-amd64 : init-buildx
84
+ $(DOCKER ) buildx build --platform=linux/amd64 \
85
+ -t validation_linux_amd64 \
86
+ --target validation-image \
87
+ --build-arg BUILDPLATFORM=linux \
88
+ --build-arg STAGINGVERSION=$(STAGINGVERSION ) .
89
+
90
+ # Used by hack/verify-docker-deps.sh, not used for building artifacts
91
+ validate-container-linux-arm64 : init-buildx
92
+ $(DOCKER ) buildx build --platform=linux/arm64 \
93
+ -t validation_linux_arm64 \
94
+ --target validation-image \
95
+ --build-arg BUILDPLATFORM=linux \
96
+ --build-arg STAGINGVERSION=$(STAGINGVERSION ) .
97
+
82
98
build-and-push-container-linux-amd64 : require-GCE_PD_CSI_STAGING_IMAGE init-buildx
83
99
$(DOCKER ) buildx build --platform=linux/amd64 \
84
100
-t $(STAGINGIMAGE ) :$(STAGINGVERSION ) _linux_amd64 \
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Copyright 2022 The Kubernetes Authors.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ set -o errexit
18
+ set -o nounset
19
+ set -o pipefail
20
+
21
+ echo " Verifying Docker Executables have appropriate dependencies"
22
+
23
+ printMissingDep () {
24
+ if /usr/bin/ldd " $@ " | grep " not found" ; then
25
+ echo " !!! Missing deps for $@ !!!"
26
+ exit 1
27
+ fi
28
+ }
29
+
30
+ export -f printMissingDep
31
+
32
+ /usr/bin/find / -type f -executable -print | /usr/bin/xargs -I {} /bin/bash -c ' printMissingDep "{}"'
Original file line number Diff line number Diff line change @@ -22,5 +22,6 @@ PKG_ROOT=$(git rev-parse --show-toplevel)
22
22
23
23
" ${PKG_ROOT} /hack/verify-gofmt.sh"
24
24
" ${PKG_ROOT} /hack/verify-govet.sh"
25
+ " ${PKG_ROOT} /hack/verify-docker-deps.sh"
25
26
26
27
make -C " ${PKG_ROOT} " all
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Copyright 2018 The Kubernetes Authors.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ set -o errexit
18
+ set -o nounset
19
+ set -o pipefail
20
+
21
+ echo " Verifying Docker Image Dependencies"
22
+
23
+ PKG_ROOT=$( git rev-parse --show-toplevel)
24
+
25
+ make -C " ${PKG_ROOT} " validate-container-linux-amd64 validate-container-linux-arm64
You can’t perform that action at this time.
0 commit comments