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 18
18
# Run this with docker build --build-arg builder_image=<golang:x.y.z>
19
19
ARG builder_image
20
20
21
+ # Build architecture
22
+ ARG ARCH
23
+
21
24
# Ignore Hadolint rule "Always tag the version of an image explicitly."
22
25
# It's an invalid finding since the image is explicitly set in the Makefile.
23
26
# https://github.com/hadolint/hadolint/wiki/DL3006
@@ -60,7 +63,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
60
63
-o manager ${package}
61
64
62
65
# Production image
63
- FROM gcr.io/distroless/static:nonroot
66
+ FROM --platform=${ARCH} gcr.io/distroless/static:nonroot
64
67
WORKDIR /
65
68
COPY --from=builder /workspace/manager .
66
69
# 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 18
18
# Run this with docker build --build-arg builder_image=<golang:x.y.z>
19
19
ARG builder_image
20
20
21
+ # Build architecture
22
+ ARG ARCH
23
+
21
24
# Ignore Hadolint rule "Always tag the version of an image explicitly."
22
25
# It's an invalid finding since the image is explicitly set in the Makefile.
23
26
# https://github.com/hadolint/hadolint/wiki/DL3006
@@ -60,7 +63,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
60
63
-o clusterctl ${package}
61
64
62
65
# Production image
63
- FROM gcr.io/distroless/static:nonroot
66
+ FROM --platform=${ARCH} gcr.io/distroless/static:nonroot
64
67
WORKDIR /
65
68
COPY --from=builder /workspace/clusterctl .
66
69
# 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 18
18
# Run this with docker build --build-arg builder_image=<golang:x.y.z>
19
19
ARG builder_image
20
20
21
+ # Build architecture
22
+ ARG ARCH
23
+
21
24
# Ignore Hadolint rule "Always tag the version of an image explicitly."
22
25
# It's an invalid finding since the image is explicitly set in the Makefile.
23
26
# https://github.com/hadolint/hadolint/wiki/DL3006
@@ -63,7 +66,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
63
66
-o /workspace/extension ${package}
64
67
65
68
# Production image
66
- FROM gcr.io/distroless/static:nonroot
69
+ FROM --platform=${ARCH} gcr.io/distroless/static:nonroot
67
70
WORKDIR /
68
71
COPY --from=builder /workspace/extension .
69
72
# 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 17
17
# Run this with docker build --build-arg builder_image=<golang:x.y.z>
18
18
ARG builder_image
19
19
20
+ # Build architecture
21
+ ARG ARCH
22
+
20
23
# Ignore Hadolint rule "Always tag the version of an image explicitly."
21
24
# It's an invalid finding since the image is explicitly set in the Makefile.
22
25
# https://github.com/hadolint/hadolint/wiki/DL3006
@@ -57,6 +60,9 @@ COPY . .
57
60
# Essentially, change directories into CAPD
58
61
WORKDIR /workspace/test/infrastructure/docker
59
62
63
+ # Build
64
+ ARG ARCH
65
+
60
66
# Build the CAPD manager using the compiler cache folder
61
67
RUN --mount=type=cache,target=/root/.cache/go-build \
62
68
--mount=type=cache,target=/go/pkg/mod \
@@ -67,7 +73,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
67
73
# Ignore Hadolint rule "Using latest is prone to errors if the image will ever update. Pin the version explicitly to a release tag."
68
74
# https://github.com/hadolint/hadolint/wiki/DL3007
69
75
# hadolint ignore=DL3007
70
- FROM gcr.io/distroless/static:latest
76
+ FROM --platform=${ARCH} gcr.io/distroless/static:latest
71
77
72
78
WORKDIR /
73
79
COPY --from=builder /workspace/manager .
You can’t perform that action at this time.
0 commit comments