diff --git a/Dockerfile b/Dockerfile index c07e626a6..3e6efd7b3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,10 @@ FROM node:18@sha256:d0bbfdbad0bff8253e6159dcbee42141db4fc309365d5b8bcfce46ed7156 WORKDIR /headlamp-plugins # Add a build argument for the desired plugin to be built +# Add multi-arch build arguments ARG PLUGIN +ARG TARGETPLATFORM +ARG TARGETARCH # Check if the PLUGIN argument is provided RUN if [ -z "$PLUGIN" ]; then \ @@ -13,6 +16,12 @@ RUN if [ -z "$PLUGIN" ]; then \ exit 1; \ fi +# Enforce that TARGETARCH is specified +RUN if [ -z "$TARGETARCH" ]; then \ + echo "Error: TARGETARCH argument is required"; \ + exit 1; \ + fi + # Create a directory for the plugin build RUN mkdir -p /headlamp-plugins/build/${PLUGIN} @@ -41,6 +50,7 @@ COPY --from=builder /headlamp-plugins/build/ /plugins/ LABEL org.opencontainers.image.source=https://github.com/headlamp-k8s/plugins LABEL org.opencontainers.image.licenses=MIT +LABEL org.opencontainers.image.platform=$TARGETPLATFORM # Set the default command to list the installed plugins CMD ["sh", "-c", "echo Plugins installed at /plugins/:; ls /plugins/"]