Dockerfile 1.8 KB

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