forked from kubernetes-sigs/headlamp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.plugins
More file actions
34 lines (24 loc) · 1.5 KB
/
Dockerfile.plugins
File metadata and controls
34 lines (24 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Build the plugin
FROM node:22@sha256:379c51ac7bbf9bffe16769cfda3eb027d59d9c66ac314383da3fcf71b46d026c as builder
# Set the working directory
WORKDIR /headlamp-plugins
# Copy the example plugins source code to the working directory
COPY ./plugins/examples /headlamp-plugins/
# Copy the plugin source code to the working directory
COPY ./plugins/headlamp-plugin /headlamp-plugins/headlamp-plugin
# Install dependencies.
# We are doing so that we can use the local binary to build
# the example plugin.
RUN chmod +x /headlamp-plugins/headlamp-plugin/install-dependencies.sh && /headlamp-plugins/headlamp-plugin/install-dependencies.sh
# Create a build directory
RUN mkdir -p /headlamp-plugins/build
# Build the example plugins (excluding headlamp-plugin)
RUN find /headlamp-plugins -mindepth 1 -maxdepth 1 -type d ! -name "headlamp-plugin" -exec ./headlamp-plugin/bin/headlamp-plugin.js build {} \;
# Extract the built plugin files to the build directory (excluding headlamp-plugin)
RUN find /headlamp-plugins -mindepth 1 -maxdepth 1 -type d ! -name "headlamp-plugin" -exec ./headlamp-plugin/bin/headlamp-plugin.js extract {} /headlamp-plugins/build \;
# Create the final image
FROM alpine:3.23.3@sha256:25109184c71bdad752c8312a8623239686a9a2071e8825f20acb8f2198c3f659
# Copy the built plugin files from the first stage to /plugins directory
COPY --from=builder /headlamp-plugins/build/ /plugins/
# Command to run when the container starts
CMD ["/bin/sh", "-c", "mkdir -p /build/plugins && cp -r /plugins/* /build/plugins/"]