Skip to content

Commit b7edee4

Browse files
authored
Fix warnings reported while building container images (#2701)
1 parent 77ada2d commit b7edee4

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

Dockerfile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ ARG DEBIAN_IMAGE=registry.k8s.io/build-image/debian-base:bookworm-v1.0.4
3838
# Build an image containing a common ca-certificates used by all target images
3939
# regardless of how they are built. We arbitrarily take ca-certificates from
4040
# the amd64 Alpine image.
41-
FROM --platform=linux/amd64 ${ALPINE_IMAGE} as certs
41+
FROM --platform=${BUILDPLATFORM} ${ALPINE_IMAGE} AS certs
4242
RUN apk add --no-cache ca-certificates
4343

4444

4545
# Build all command targets. We build all command targets in a single build
4646
# stage for efficiency. Target images copy their binary from this image.
4747
# We use go's native cross compilation for multi-arch in this stage, so the
4848
# builder itself is always amd64
49-
FROM --platform=linux/amd64 ${GOLANG_IMAGE} as builder
49+
FROM --platform=${BUILDPLATFORM} ${GOLANG_IMAGE} AS builder
5050

5151
ARG GOPROXY=https://goproxy.io,direct
5252
ARG TARGETOS
@@ -67,7 +67,7 @@ RUN make build GOOS=${TARGETOS} GOARCH=${TARGETARCH} GOPROXY=${GOPROXY} VERSION=
6767
##
6868
## openstack-cloud-controller-manager
6969
##
70-
FROM --platform=${TARGETPLATFORM} ${DISTROLESS_IMAGE} as openstack-cloud-controller-manager
70+
FROM ${DISTROLESS_IMAGE} AS openstack-cloud-controller-manager
7171

7272
COPY --from=certs /etc/ssl/certs /etc/ssl/certs
7373
COPY --from=builder /build/openstack-cloud-controller-manager /bin/openstack-cloud-controller-manager
@@ -85,7 +85,7 @@ CMD [ "/bin/openstack-cloud-controller-manager" ]
8585
##
8686
## barbican-kms-plugin
8787
##
88-
FROM --platform=${TARGETPLATFORM} ${ALPINE_IMAGE} as barbican-kms-plugin
88+
FROM ${ALPINE_IMAGE} AS barbican-kms-plugin
8989
# barbican-kms-plugin uses ALPINE instead of distroless because its entrypoint
9090
# uses a shell for environment substitution. If there are no other uses this
9191
# could be replaced by callers passing arguments explicitly.
@@ -109,15 +109,15 @@ CMD ["sh", "-c", "/bin/barbican-kms-plugin --socketpath ${socketpath} --cloud-co
109109

110110
# step 1: copy all necessary files from Debian distro to /dest folder
111111
# all magic happens in tools/csi-deps.sh
112-
FROM --platform=${TARGETPLATFORM} ${DEBIAN_IMAGE} as cinder-csi-plugin-utils
112+
FROM ${DEBIAN_IMAGE} AS cinder-csi-plugin-utils
113113

114114
RUN clean-install bash rsync mount udev btrfs-progs e2fsprogs xfsprogs util-linux
115115
COPY tools/csi-deps.sh /tools/csi-deps.sh
116116
RUN /tools/csi-deps.sh
117117

118118
# step 2: check if all necessary files are copied and work properly
119119
# the build have to finish without errors, but the result image will not be used
120-
FROM --platform=${TARGETPLATFORM} ${DISTROLESS_IMAGE} as cinder-csi-plugin-utils-check
120+
FROM ${DISTROLESS_IMAGE} AS cinder-csi-plugin-utils-check
121121

122122
COPY --from=cinder-csi-plugin-utils /dest /
123123
COPY --from=cinder-csi-plugin-utils /bin/sh /bin/sh
@@ -127,7 +127,7 @@ SHELL ["/bin/sh"]
127127
RUN /tools/csi-deps-check.sh
128128

129129
# step 3: build tiny cinder-csi-plugin image with only necessary files
130-
FROM --platform=${TARGETPLATFORM} ${DISTROLESS_IMAGE} as cinder-csi-plugin
130+
FROM ${DISTROLESS_IMAGE} AS cinder-csi-plugin
131131

132132
# Copying csi-deps-check.sh simply ensures that the resulting image has a dependency
133133
# on cinder-csi-plugin-utils-check and therefore that the check has passed
@@ -149,7 +149,7 @@ CMD ["/bin/cinder-csi-plugin"]
149149
##
150150
## k8s-keystone-auth
151151
##
152-
FROM --platform=${TARGETPLATFORM} ${DISTROLESS_IMAGE} as k8s-keystone-auth
152+
FROM ${DISTROLESS_IMAGE} AS k8s-keystone-auth
153153

154154
COPY --from=builder /build/k8s-keystone-auth /bin/k8s-keystone-auth
155155
COPY --from=certs /etc/ssl/certs /etc/ssl/certs
@@ -169,7 +169,7 @@ CMD ["/bin/k8s-keystone-auth"]
169169
##
170170
## magnum-auto-healer
171171
##
172-
FROM --platform=${TARGETPLATFORM} ${DISTROLESS_IMAGE} as magnum-auto-healer
172+
FROM ${DISTROLESS_IMAGE} AS magnum-auto-healer
173173

174174
COPY --from=builder /build/magnum-auto-healer /bin/magnum-auto-healer
175175
COPY --from=certs /etc/ssl/certs /etc/ssl/certs
@@ -187,7 +187,7 @@ CMD ["/bin/magnum-auto-healer"]
187187
##
188188
## manila-csi-plugin
189189
##
190-
FROM --platform=${TARGETPLATFORM} ${ALPINE_IMAGE} as manila-csi-plugin
190+
FROM ${ALPINE_IMAGE} AS manila-csi-plugin
191191
# manila-csi-plugin uses ALPINE because it pulls in jq and curl
192192

193193
RUN apk add --no-cache jq curl
@@ -208,7 +208,7 @@ ENTRYPOINT ["/bin/manila-csi-plugin"]
208208
##
209209
## octavia-ingress-controller
210210
##
211-
FROM --platform=${TARGETPLATFORM} ${DISTROLESS_IMAGE} as octavia-ingress-controller
211+
FROM ${DISTROLESS_IMAGE} AS octavia-ingress-controller
212212

213213
COPY --from=builder /build/octavia-ingress-controller /bin/octavia-ingress-controller
214214
COPY --from=certs /etc/ssl/certs /etc/ssl/certs

0 commit comments

Comments
 (0)