2020-12-09 17:47:17 +01:00
|
|
|
# Start with a NodeJS base image that also contains yarn.
|
2024-10-23 14:31:52 +02:00
|
|
|
FROM node:22.8.0-alpine@sha256:bec0ea49c2333c429b62e74e91f8ba1201b060110745c3a12ff957cd51b363c6 as nodejsbuilder
|
2020-06-02 14:29:34 +02:00
|
|
|
|
2020-11-25 15:28:51 +01:00
|
|
|
# Pass a tag, branch or a commit using build-arg. This allows a docker image to
|
|
|
|
|
# be built from a specified Git state. The default image will use the Git tip of
|
|
|
|
|
# master by default.
|
|
|
|
|
ARG checkout="master"
|
|
|
|
|
|
2021-10-08 11:35:06 +02:00
|
|
|
# The public URL the static files should be served under. This must be empty to
|
|
|
|
|
# work for the root path (/).
|
|
|
|
|
ARG public_url=""
|
|
|
|
|
|
2020-12-09 17:47:18 +01:00
|
|
|
# There seem to be multiple problems when using yarn for a build inside of a
|
|
|
|
|
# docker image:
|
|
|
|
|
# 1. For building and installing node-gyp, python is required. This seems to
|
|
|
|
|
# be missing from the NodeJS base image for ARM builds (or is just required
|
|
|
|
|
# when building for ARM?).
|
|
|
|
|
# 2. Because of a problem in the docker internal network on ARM, some TCP
|
|
|
|
|
# packages are being dropped and the yarn installation times out. This can
|
|
|
|
|
# be mitigated by switching to HTTP and increasing the network timeout.
|
|
|
|
|
# See https://github.com/yarnpkg/yarn/issues/5259 for more info.
|
2020-12-09 17:47:17 +01:00
|
|
|
RUN apk add --no-cache --update alpine-sdk \
|
2022-04-03 01:02:27 -04:00
|
|
|
git \
|
2020-12-09 17:47:17 +01:00
|
|
|
&& git clone https://github.com/lightninglabs/lightning-terminal /go/src/github.com/lightninglabs/lightning-terminal \
|
|
|
|
|
&& cd /go/src/github.com/lightninglabs/lightning-terminal \
|
|
|
|
|
&& git checkout $checkout \
|
|
|
|
|
&& cd app \
|
2020-12-09 17:47:18 +01:00
|
|
|
&& npm config set registry "http://registry.npmjs.org" \
|
|
|
|
|
&& yarn config set registry "http://registry.npmjs.org" \
|
|
|
|
|
&& yarn install --frozen-lockfile --network-timeout 1000000 \
|
2021-10-08 11:35:06 +02:00
|
|
|
&& PUBLIC_URL=$public_url yarn build
|
2020-12-09 17:47:17 +01:00
|
|
|
|
|
|
|
|
# The first stage is already done and all static assets should now be generated
|
|
|
|
|
# in the app/build sub directory.
|
2026-02-05 02:57:05 -05:00
|
|
|
FROM golang:1.24.11-alpine3.22@sha256:fb828ef85a4c4140fae45f145a84ca9c0a83fd0baa437a301b35b551e91ceed5 as golangbuilder
|
2020-12-09 17:47:17 +01:00
|
|
|
|
|
|
|
|
# Instead of checking out from git again, we just copy the whole working
|
|
|
|
|
# directory of the previous stage that includes the generated static assets.
|
|
|
|
|
COPY --from=nodejsbuilder /go/src/github.com/lightninglabs/lightning-terminal /go/src/github.com/lightninglabs/lightning-terminal
|
|
|
|
|
|
|
|
|
|
# Force Go to use the cgo based DNS resolver. This is required to ensure DNS
|
|
|
|
|
# queries required to connect to linked containers succeed.
|
|
|
|
|
ENV GODEBUG netdns=cgo
|
|
|
|
|
|
2020-07-21 22:06:15 +02:00
|
|
|
# Install dependencies and install/build lightning-terminal.
|
2020-06-02 14:29:34 +02:00
|
|
|
RUN apk add --no-cache --update alpine-sdk \
|
2022-04-03 01:02:27 -04:00
|
|
|
make \
|
2020-12-09 17:47:17 +01:00
|
|
|
&& cd /go/src/github.com/lightninglabs/lightning-terminal \
|
2021-10-08 11:35:06 +02:00
|
|
|
&& make go-install PUBLIC_URL=$public_url \
|
2020-12-09 17:47:17 +01:00
|
|
|
&& make go-install-cli
|
2020-06-02 14:29:34 +02:00
|
|
|
|
|
|
|
|
# Start a new, final image to reduce size.
|
2025-08-07 10:52:15 +02:00
|
|
|
FROM alpine:3.22.1@sha256:4bcff63911fcb4448bd4fdacec207030997caf25e9bea4045fa6c8c44de311d1 as final
|
2020-06-02 14:29:34 +02:00
|
|
|
|
|
|
|
|
# Define a root volume for data persistence.
|
|
|
|
|
VOLUME /root/.lnd
|
|
|
|
|
|
2020-07-21 22:06:15 +02:00
|
|
|
# Expose lightning-terminal and lnd ports (server, rpc).
|
2020-06-02 14:29:34 +02:00
|
|
|
EXPOSE 8443 10009 9735
|
|
|
|
|
|
|
|
|
|
# Copy the binaries and entrypoint from the builder image.
|
2020-12-09 17:47:17 +01:00
|
|
|
COPY --from=golangbuilder /go/bin/litd /bin/
|
2021-10-29 14:50:32 +02:00
|
|
|
COPY --from=golangbuilder /go/bin/litcli /bin/
|
2020-12-09 17:47:17 +01:00
|
|
|
COPY --from=golangbuilder /go/bin/lncli /bin/
|
|
|
|
|
COPY --from=golangbuilder /go/bin/frcli /bin/
|
|
|
|
|
COPY --from=golangbuilder /go/bin/loop /bin/
|
|
|
|
|
COPY --from=golangbuilder /go/bin/pool /bin/
|
2023-05-16 16:51:03 +02:00
|
|
|
COPY --from=golangbuilder /go/bin/tapcli /bin/
|
2020-06-02 14:29:34 +02:00
|
|
|
|
|
|
|
|
# Add bash.
|
|
|
|
|
RUN apk add --no-cache \
|
2022-04-03 01:02:27 -04:00
|
|
|
bash \
|
|
|
|
|
jq \
|
|
|
|
|
ca-certificates
|
2020-06-02 14:29:34 +02:00
|
|
|
|
2020-07-21 22:06:15 +02:00
|
|
|
# Specify the start command and entrypoint as the lightning-terminal daemon.
|
2020-07-21 17:21:12 -04:00
|
|
|
ENTRYPOINT ["litd"]
|