Repository navigation
Expand file tree
/
Copy pathDockerfile.plugins
More file actions
39 lines (28 loc) · 1.6 KB
/
Copy pathDockerfile.plugins
File metadata and controls
39 lines (28 loc) · 1.6 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
35
36
37
38
39
# Build the plugin
FROM node:22@sha256:8a34c4ab3ea2c5cd194f07e317b2a8f09461d3c8b05c4e34c8ccd56d56024c4d 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.24.1@sha256:28bd5fe8b56d1bd048e5babf5b10710ebe0bae67db86916198a6eec434943f8b
# Install OpenSSL runtime packages
RUN apk add --no-cache \
'libcrypto3=3.5.8-r0' \
'libssl3=3.5.8-r0'
# 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/"]