Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add target platform for dockerfile, mutli arch image builds #135

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,23 @@ 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 \
echo "Error: PLUGIN argument is required"; \
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}

Expand Down Expand Up @@ -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/"]
Loading