File tree Expand file tree Collapse file tree 4 files changed +19
-4
lines changed Expand file tree Collapse file tree 4 files changed +19
-4
lines changed Original file line number Diff line number Diff line change 1818# Run this with docker build --build-arg builder_image=<golang:x.y.z>
1919ARG builder_image
2020
21+ # Build architecture
22+ ARG ARCH
23+
2124# Ignore Hadolint rule "Always tag the version of an image explicitly."
2225# It's an invalid finding since the image is explicitly set in the Makefile.
2326# https://github.com/hadolint/hadolint/wiki/DL3006
@@ -60,7 +63,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
6063 -o manager ${package}
6164
6265# Production image
63- FROM gcr.io/distroless/static:nonroot
66+ FROM --platform=${ARCH} gcr.io/distroless/static:nonroot
6467WORKDIR /
6568COPY --from=builder /workspace/manager .
6669# Use uid of nonroot user (65532) because kubernetes expects numeric user when applying pod security policies
Original file line number Diff line number Diff line change 1818# Run this with docker build --build-arg builder_image=<golang:x.y.z>
1919ARG builder_image
2020
21+ # Build architecture
22+ ARG ARCH
23+
2124# Ignore Hadolint rule "Always tag the version of an image explicitly."
2225# It's an invalid finding since the image is explicitly set in the Makefile.
2326# https://github.com/hadolint/hadolint/wiki/DL3006
@@ -60,7 +63,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
6063 -o clusterctl ${package}
6164
6265# Production image
63- FROM gcr.io/distroless/static:nonroot
66+ FROM --platform=${ARCH} gcr.io/distroless/static:nonroot
6467WORKDIR /
6568COPY --from=builder /workspace/clusterctl .
6669# Use uid of nonroot user (65532) because kubernetes expects numeric user when applying pod security policies
Original file line number Diff line number Diff line change 1818# Run this with docker build --build-arg builder_image=<golang:x.y.z>
1919ARG builder_image
2020
21+ # Build architecture
22+ ARG ARCH
23+
2124# Ignore Hadolint rule "Always tag the version of an image explicitly."
2225# It's an invalid finding since the image is explicitly set in the Makefile.
2326# https://github.com/hadolint/hadolint/wiki/DL3006
@@ -63,7 +66,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
6366 -o /workspace/extension ${package}
6467
6568# Production image
66- FROM gcr.io/distroless/static:nonroot
69+ FROM --platform=${ARCH} gcr.io/distroless/static:nonroot
6770WORKDIR /
6871COPY --from=builder /workspace/extension .
6972# Use uid of nonroot user (65532) because kubernetes expects numeric user when applying pod security policies
Original file line number Diff line number Diff line change 1717# Run this with docker build --build-arg builder_image=<golang:x.y.z>
1818ARG builder_image
1919
20+ # Build architecture
21+ ARG ARCH
22+
2023# Ignore Hadolint rule "Always tag the version of an image explicitly."
2124# It's an invalid finding since the image is explicitly set in the Makefile.
2225# https://github.com/hadolint/hadolint/wiki/DL3006
@@ -57,6 +60,9 @@ COPY . .
5760# Essentially, change directories into CAPD
5861WORKDIR /workspace/test/infrastructure/docker
5962
63+ # Build
64+ ARG ARCH
65+
6066# Build the CAPD manager using the compiler cache folder
6167RUN --mount=type=cache,target=/root/.cache/go-build \
6268 --mount=type=cache,target=/go/pkg/mod \
@@ -67,7 +73,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
6773# Ignore Hadolint rule "Using latest is prone to errors if the image will ever update. Pin the version explicitly to a release tag."
6874# https://github.com/hadolint/hadolint/wiki/DL3007
6975# hadolint ignore=DL3007
70- FROM gcr.io/distroless/static:latest
76+ FROM --platform=${ARCH} gcr.io/distroless/static:latest
7177
7278WORKDIR /
7379COPY --from=builder /workspace/manager .
You can’t perform that action at this time.
0 commit comments