Skip to content

Commit 26fdde0

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 7713a42 commit 26fdde0

File tree

1 file changed

+99
-3
lines changed

1 file changed

+99
-3
lines changed

Dockerfile

Lines changed: 99 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,70 @@ 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 AR=${target_arch}-ar
170+
ARG AS=${target_arch}-as
171+
ARG CC=${target_arch}-gcc
172+
ARG CXX=${target_arch}-g++
173+
ARG LD=${target_arch}-ld
174+
ARG STRIP=${target_arch}-strip
175+
ARG TARGET=${target_arch_rust}
176+
ARG RUST_PROFILE=release
177+
ARG VERSION
178+
ENV VERSION=${VERSION}
179+
ARG VLS_VERSION=v0.14.0
180+
181+
RUN dpkg --add-architecture ${target_arch_dpkg}
182+
183+
# Install architecture-independent libraries
184+
RUN apt-get update && \
185+
apt-get install -qq -y --no-install-recommends \
186+
python3-dev \
187+
lowdown
188+
189+
# Install target-arch libraries
190+
RUN apt-get install -qq -y --no-install-recommends \
191+
pkg-config:${target_arch_dpkg} \
192+
libffi-dev:${target_arch_dpkg} \
193+
libicu-dev:${target_arch_dpkg} \
194+
zlib1g-dev:${target_arch_dpkg} \
195+
libsqlite3-dev:${target_arch_dpkg} \
196+
libpq-dev:${target_arch_dpkg} \
197+
libsodium-dev:${target_arch_dpkg} \
198+
crossbuild-essential-${target_arch_dpkg}
199+
200+
WORKDIR /opt
201+
202+
RUN ./install-uv.sh -q
203+
RUN ./install-rust.sh -y -q --profile minimal --component rustfmt --target ${target_arch_rust}
204+
ENV PATH="/root/.cargo/bin:/root/.local/bin:${PATH}"
205+
206+
RUN git clone --depth 1 --branch ${VLS_VERSION} https://gitlab.com/lightning-signer/validating-lightning-signer.git
207+
WORKDIR /opt/validating-lightning-signer
208+
209+
RUN mkdir -p .cargo && tee .cargo/config.toml <<EOF
210+
211+
[build]
212+
target = "${target_arch_rust}"
213+
rustflags = ["-C", "target-cpu=generic"]
214+
215+
[target.${target_arch_rust}]
216+
linker = "${CC}"
217+
218+
EOF
219+
220+
RUN cargo build --release
221+
222+
RUN cp -r ./target/${target_arch_rust}/release/ /tmp/vls_install/ \
223+
&& find /tmp/vls_install -type f -executable -exec \
224+
file {} + | \
225+
awk -F: '/ELF/ {print $1}' | \
226+
xargs -r ${STRIP} --strip-unneeded
227+
228+
# Standard Lightning image (without VLS)
229+
FROM base-target AS lightningd
167230

168231
RUN apt-get update && \
169232
apt-get install -qq -y --no-install-recommends \
@@ -176,8 +239,8 @@ RUN apt-get update && \
176239
apt-get clean && \
177240
rm -rf /var/lib/apt/lists/*
178241

179-
COPY --from=downloader /opt/bitcoin/bin/bitcoin-cli /usr/bin/
180-
COPY --from=builder /tmp/lightning_install/ /usr/local/
242+
COPY --from=downloader /opt/bitcoin/bin/bitcoin-cli /usr/bin/
243+
COPY --from=builder /tmp/lightning_install/ /usr/local/
181244

182245
COPY tools/docker-entrypoint.sh /entrypoint.sh
183246

@@ -189,3 +252,36 @@ ENV LIGHTNINGD_NETWORK=bitcoin
189252
EXPOSE 9735 9835
190253
VOLUME ["/root/.lightning"]
191254
ENTRYPOINT ["/entrypoint.sh"]
255+
256+
# Lightning with VLS Signer
257+
FROM base-target AS lightningd-vls-signer
258+
259+
RUN apt-get update && \
260+
apt-get install -qq -y --no-install-recommends \
261+
inotify-tools \
262+
socat \
263+
jq \
264+
libpq5 \
265+
libsqlite3-0 \
266+
libsodium23 && \
267+
apt-get clean && \
268+
rm -rf /var/lib/apt/lists/*
269+
270+
COPY --from=downloader /opt/bitcoin/bin/bitcoin-cli /usr/bin/
271+
COPY --from=builder /tmp/lightning_install/ /usr/local/
272+
COPY --from=vls-builder /tmp/vls_install/remote_hsmd_socket /var/lib/vls/bin/
273+
274+
COPY tools/docker-entrypoint.sh /entrypoint.sh
275+
276+
ENV LIGHTNINGD_DATA=/root/.lightning
277+
ENV LIGHTNINGD_RPC_PORT=9835
278+
ENV LIGHTNINGD_PORT=9735
279+
ENV LIGHTNINGD_NETWORK=bitcoin
280+
ENV VLS_ENABLED=true
281+
282+
EXPOSE 9735 9835
283+
VOLUME ["/root/.lightning"]
284+
ENTRYPOINT ["/entrypoint.sh"]
285+
286+
# Default target (for backward compatibility)
287+
FROM lightningd AS final

0 commit comments

Comments
 (0)