Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dockerfile and sample docker compose #176

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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

# Create a new directory for the application
WORKDIR /app

# Copy the entire project
COPY . .

# Build dependencies and the project
RUN cargo build --release

# Create a new stage with a minimal image
FROM ubuntu:22.04 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"]
27 changes: 27 additions & 0 deletions sample-docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
services:
lnd:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we run lnd without any config and bitcoind?

container_name: lnd
image: docker.io/lightninglabs/lnd:v0.18.3-beta.rc3
restart: unless-stopped
stop_grace_period: 15m30s
volumes:
- /root/lnd:/root/.lnd
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using root directory of a host file systems(/root/lnd) seems not a good idea for me.
Is this standard way in docker?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The standard I've seen is lnd:/root/.lnd or something similar, can we change it to that @niteshbalusu11?

ports:
- "9735:9735"
- "10009:10009"
- "4000:4000"
command:
lnd

lndk:
container_name: lndk
image: lndk
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replacing with build . seems better?
We don't have any plans to upload lndk images to a repository at the moment, so building them locally seems sufficient.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I like the idea of replacing image with build. That way, if a user hasn't built lndk yet, they can still use the docker compose file.

depends_on: [lnd]
restart: on-failure
stop_grace_period: 20s
volumes:
- /root/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