From b8b286a5996c193e00745279df9f36e5892b8030 Mon Sep 17 00:00:00 2001 From: benthecarman Date: Wed, 31 Jul 2024 17:04:32 -0500 Subject: [PATCH] Add lndk --- docker-compose.yml | 13 ++++++++++++ lndk/Dockerfile | 49 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 lndk/Dockerfile diff --git a/docker-compose.yml b/docker-compose.yml index 1b30de1..ed71dcb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -77,6 +77,19 @@ services: - "9735:9735" - "10009:10009" - "8081:8081" + lndk: + build: ./lndk + restart: unless-stopped + user: "0:1000" + logging: *default-logging + depends_on: + - lnd + command: --address=https://lnd:10009 --cert-path=/root/.lnd/tls.cert --macaroon-path=/root/.lnd/data/chain/bitcoin/signet/admin.macaroon --log-level=trace --grpc-host=0.0.0.0 + environment: + - RUST_BACKTRACE=1 + volumes: + - ~/volumes/lndk:/root/.lndk + - ~/volumes/.lnd:/root/.lnd:ro rgs_server: container_name: "rgs-server" logging: *default-logging diff --git a/lndk/Dockerfile b/lndk/Dockerfile new file mode 100644 index 0000000..95630c8 --- /dev/null +++ b/lndk/Dockerfile @@ -0,0 +1,49 @@ +################# +# Builder image # +################# +FROM rust:1.78-bookworm AS builder + +# References for lndk +ARG LNDK_SOURCE=https://github.com/lndk-org/lndk.git +ARG LNDK_REF=60e17a0c94177f7d2d160aa08f5cc32a1274b51e + +# Add utils +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + protobuf-compiler \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# Set the working directory in the Docker image +WORKDIR /usr/src + +# Grab and install the latest version of lndk +RUN git clone ${LNDK_SOURCE} . \ + && git reset --hard ${LNDK_REF} \ + && cargo build --release + +# Copy the compiled binaries to /bin/ +RUN cp ./target/release/lndk /bin/ +RUN cp ./target/release/lndk-cli /bin/ + +############### +# final image # +############### +FROM debian:bookworm-slim AS final + +# Add utils +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + bash \ + curl \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# Copy the compiled binaries from the builder image +COPY --from=builder /bin/lndk /usr/local/bin/ +COPY --from=builder /bin/lndk-cli /usr/local/bin/ + +# Expose grpc port +EXPOSE 7000 + +ENTRYPOINT ["lndk"] \ No newline at end of file