forked from headlamp-k8s/headlamp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.plugins
34 lines (24 loc) · 1.36 KB
/
Dockerfile.plugins
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:20.0.0 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:latest
# 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/"]