/ Dockerfile
Dockerfile
1 # If you change this please also update GO_VERSION in Makefile (then run 2 # `make lint` to see where else it needs to be updated as well). 3 FROM golang:1.25.5-alpine as builder 4 5 # Force Go to use the cgo based DNS resolver. This is required to ensure DNS 6 # queries required to connect to linked containers succeed. 7 ENV GODEBUG netdns=cgo 8 9 # Pass a tag, branch or a commit using build-arg. This allows a docker 10 # image to be built from a specified Git state. The default image 11 # will use the Git tip of master by default. 12 ARG checkout="master" 13 ARG git_url="https://github.com/lightningnetwork/lnd" 14 15 # Install dependencies and build the binaries. 16 RUN apk add --no-cache --update alpine-sdk \ 17 git \ 18 make \ 19 gcc \ 20 && git clone $git_url /go/src/github.com/lightningnetwork/lnd \ 21 && cd /go/src/github.com/lightningnetwork/lnd \ 22 && git checkout $checkout \ 23 && make release-install 24 25 # Start a new, final image. 26 FROM alpine as final 27 28 # Define a root volume for data persistence. 29 VOLUME /root/.lnd 30 31 # Add utilities for quality of life and SSL-related reasons. We also require 32 # wget and gpg for the signature verification script. 33 RUN apk --no-cache add \ 34 bash \ 35 jq \ 36 ca-certificates \ 37 gnupg \ 38 wget 39 40 # Copy the binaries from the builder image. 41 COPY --from=builder /go/bin/lncli /bin/ 42 COPY --from=builder /go/bin/lnd /bin/ 43 COPY --from=builder /go/src/github.com/lightningnetwork/lnd/scripts/verify-install.sh / 44 COPY --from=builder /go/src/github.com/lightningnetwork/lnd/scripts/keys/* /keys/ 45 46 # Store the SHA256 hash of the binaries that were just produced for later 47 # verification. 48 RUN sha256sum /bin/lnd /bin/lncli > /shasums.txt \ 49 && cat /shasums.txt 50 51 # Expose lnd ports (p2p, rpc). 52 EXPOSE 9735 10009 53 54 # Specify the start command and entrypoint as the lnd daemon. 55 ENTRYPOINT ["lnd"]