Skip to content

Commit 968c9f2

Browse files
docker: Add vls remote_hsmd_socket binary
This Dockerfile builds the VLS binaries during the builder stage and copies only the `remote_hsmd_socket` binary into the `lightningd-vls-signer` flavor.
1 parent 8732410 commit 968c9f2

File tree

1 file changed

+73
-3
lines changed

1 file changed

+73
-3
lines changed

Dockerfile

Lines changed: 73 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,44 @@ RUN find /tmp/lightning_install -type f -executable -exec \
163163
awk -F: '/ELF/ {print $1}' | \
164164
xargs -r ${STRIP} --strip-unneeded
165165

166-
FROM base-target AS final
166+
# VLS builder stage (only used by lightningd-vls-signer)
167+
FROM base-builder-${TARGETOS}-${TARGETARCH} AS vls-builder
168+
169+
ARG target_arch_rust
170+
ARG CC
171+
ARG VLS_VERSION=v0.14.0
172+
173+
ENV PATH="/root/.cargo/bin:/root/.local/bin:${PATH}"
174+
175+
WORKDIR /opt
176+
177+
RUN ./install-uv.sh -q
178+
RUN ./install-rust.sh -y -q --profile minimal --component rustfmt --target ${target_arch_rust}
179+
180+
RUN git clone --depth 1 --branch ${VLS_VERSION} https://gitlab.com/lightning-signer/validating-lightning-signer.git
181+
WORKDIR /opt/validating-lightning-signer
182+
183+
RUN mkdir -p .cargo && tee .cargo/config.toml <<EOF
184+
185+
[build]
186+
target = "${target_arch_rust}"
187+
rustflags = ["-C", "target-cpu=generic"]
188+
189+
[target.${target_arch_rust}]
190+
linker = "${CC}"
191+
192+
EOF
193+
194+
RUN cargo build --release
195+
196+
RUN cp -r ./target/${target_arch_rust}/release/ /tmp/vls_install/ \
197+
&& find /tmp/vls_install -type f -executable -exec \
198+
file {} + | \
199+
awk -F: '/ELF/ {print $1}' | \
200+
xargs -r ${STRIP} --strip-unneeded
201+
202+
# Standard Lightning image (without VLS)
203+
FROM base-target AS lightningd
167204

168205
RUN apt-get update && \
169206
apt-get install -qq -y --no-install-recommends \
@@ -176,8 +213,8 @@ RUN apt-get update && \
176213
apt-get clean && \
177214
rm -rf /var/lib/apt/lists/*
178215

179-
COPY --from=downloader /opt/bitcoin/bin/bitcoin-cli /usr/bin/
180-
COPY --from=builder /tmp/lightning_install/ /usr/local/
216+
COPY --from=downloader /opt/bitcoin/bin/bitcoin-cli /usr/bin/
217+
COPY --from=builder /tmp/lightning_install/ /usr/local/
181218

182219
COPY tools/docker-entrypoint.sh /entrypoint.sh
183220

@@ -189,3 +226,36 @@ ENV LIGHTNINGD_NETWORK=bitcoin
189226
EXPOSE 9735 9835
190227
VOLUME ["/root/.lightning"]
191228
ENTRYPOINT ["/entrypoint.sh"]
229+
230+
# Lightning with VLS Signer
231+
FROM base-target AS lightningd-vls-signer
232+
233+
RUN apt-get update && \
234+
apt-get install -qq -y --no-install-recommends \
235+
inotify-tools \
236+
socat \
237+
jq \
238+
libpq5 \
239+
libsqlite3-0 \
240+
libsodium23 && \
241+
apt-get clean && \
242+
rm -rf /var/lib/apt/lists/*
243+
244+
COPY --from=downloader /opt/bitcoin/bin/bitcoin-cli /usr/bin/
245+
COPY --from=builder /tmp/lightning_install/ /usr/local/
246+
COPY --from=vls-builder /tmp/vls_install/remote_hsmd_socket /var/lib/vls/bin/
247+
248+
COPY tools/docker-entrypoint.sh /entrypoint.sh
249+
250+
ENV LIGHTNINGD_DATA=/root/.lightning
251+
ENV LIGHTNINGD_RPC_PORT=9835
252+
ENV LIGHTNINGD_PORT=9735
253+
ENV LIGHTNINGD_NETWORK=bitcoin
254+
ENV VLS_ENABLED=true
255+
256+
EXPOSE 9735 9835
257+
VOLUME ["/root/.lightning"]
258+
ENTRYPOINT ["/entrypoint.sh"]
259+
260+
# Default target (for backward compatibility)
261+
FROM lightningd AS final

0 commit comments

Comments
 (0)