docker: add docker and docker-compose support

add same docker support

modify sample docker compose file

include lndk-cli in the docker image

fix docker compose file

update dockerfile to use github and use slimmer image

lower grace period

use better lnd paths

add some lnd config
This commit is contained in:
Nitesh Balusu 2024-09-25 00:10:58 -04:00
parent 1cf2906d5d
commit 25f4fea9f7
No known key found for this signature in database
GPG key ID: 59B47B659C06F755
2 changed files with 72 additions and 0 deletions

30
Dockerfile Normal file
View file

@ -0,0 +1,30 @@
# Use the official Rust image as the base image
FROM rust:1.81 AS builder
# Install protobuf compiler
RUN apt-get update && apt-get install -y protobuf-compiler git
# Create a new directory for the application
WORKDIR /app
# Clone the repository instead of copying local files
RUN git clone https://github.com/lndk-org/lndk .
# Build dependencies and the project
RUN cargo build --release
# Create a new stage with a minimal image
FROM debian:bookworm-slim AS final
# Install necessary runtime dependencies
RUN apt-get update && \
apt-get install -y libssl3 ca-certificates && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Copy the built executables from the builder stage
COPY --from=builder /app/target/release/lndk /usr/local/bin/lndk
COPY --from=builder /app/target/release/lndk-cli /usr/local/bin/lndk-cli
# Set the startup command
CMD ["lndk"]

View file

@ -0,0 +1,42 @@
services:
lnd:
container_name: lnd
image: docker.io/lightninglabs/lnd:v0.18.4-beta
restart: unless-stopped
stop_grace_period: 5m30s
volumes:
- ~/lnd:/root/.lnd
ports:
- "9735:9735"
- "10009:10009"
command:
lnd
--listen=0.0.0.0:9735
--rpclisten=0.0.0.0:10009
--bitcoin.active
--bitcoin.mainnet
--bitcoin.node=neutrino
--neutrino.addpeer=btcd-mainnet.lightning.computer
--tlsextradomain=lnd
--tlsextradomain=lndk
--accept-keysend
--fee.url=https://nodes.lightning.computer/fees/v1/btctestnet-fee-estimates.json
--protocol.custom-message=513
--protocol.custom-nodeann=39
--protocol.custom-init=39
lndk:
container_name: lndk
image: lndk
build:
context: .
dockerfile: Dockerfile
depends_on: [lnd]
restart: on-failure
stop_grace_period: 20s
volumes:
- ~/lnd:/lnd:ro
command: >
lndk --address=https://lnd:10009 --cert-path=/lnd/tls.cert --macaroon-path=/lnd/data/chain/bitcoin/mainnet/admin.macaroon
environment:
- RUST_LOG=info