Skip to content

Commit 9d3e4b4

Browse files
committed
Dockerfile: add target platform
Signed-off-by: ashu8912 <[email protected]>
1 parent c677ea6 commit 9d3e4b4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,23 @@ FROM node:18@sha256:d0bbfdbad0bff8253e6159dcbee42141db4fc309365d5b8bcfce46ed7156
55
WORKDIR /headlamp-plugins
66

77
# Add a build argument for the desired plugin to be built
8+
# Add multi-arch build arguments
89
ARG PLUGIN
10+
ARG TARGETPLATFORM
11+
ARG TARGETARCH
912

1013
# Check if the PLUGIN argument is provided
1114
RUN if [ -z "$PLUGIN" ]; then \
1215
echo "Error: PLUGIN argument is required"; \
1316
exit 1; \
1417
fi
1518

19+
# Enforce that TARGETARCH is specified
20+
RUN if [ -z "$TARGETARCH" ]; then \
21+
echo "Error: TARGETARCH argument is required"; \
22+
exit 1; \
23+
fi
24+
1625
# Create a directory for the plugin build
1726
RUN mkdir -p /headlamp-plugins/build/${PLUGIN}
1827

@@ -41,6 +50,7 @@ COPY --from=builder /headlamp-plugins/build/ /plugins/
4150

4251
LABEL org.opencontainers.image.source=https://github.com/headlamp-k8s/plugins
4352
LABEL org.opencontainers.image.licenses=MIT
53+
LABEL org.opencontainers.image.platform=$TARGETPLATFORM
4454

4555
# Set the default command to list the installed plugins
4656
CMD ["sh", "-c", "echo Plugins installed at /plugins/:; ls /plugins/"]

0 commit comments

Comments
 (0)