- build vls and copy binary in final layer - update configs - add vls port, network, rust log and rpc url in env - compose: set env variable in compose only - dont separate env files, ease of access on env vars with compose - common across networks set in dockerfile Signed-off-by: Lakshya Singh <lakshay.singh1108@gmail.com>
150 lines
4.1 KiB
Docker
150 lines
4.1 KiB
Docker
# build stage for core lightning and clboss
|
|
FROM --platform=${TARGETPLATFORM:-${BUILDPLATFORM:-linux/amd64}} alpine:3.18 as builder
|
|
|
|
ARG TARGETPLATFORM
|
|
|
|
WORKDIR /build
|
|
|
|
RUN apk update && \
|
|
apk add \
|
|
alpine-sdk \
|
|
autoconf \
|
|
automake \
|
|
ca-certificates \
|
|
cargo \
|
|
gettext \
|
|
git \
|
|
gmp-dev \
|
|
libsodium \
|
|
libtool \
|
|
net-tools \
|
|
postgresql-dev \
|
|
py3-mako \
|
|
python3 \
|
|
python3-dev \
|
|
sqlite-dev \
|
|
sqlite-static \
|
|
zlib-dev \
|
|
zlib-static
|
|
|
|
ARG CORE_LIGHTNING_GIT_HASH=bd9494c65be09e6f8ecb3bc49b50a859467a65fe
|
|
ARG CORE_LIGHTNING_REPO=https://github.com/lightning-signer/c-lightning.git
|
|
RUN git clone --recursive $CORE_LIGHTNING_REPO /repo && \
|
|
cd /repo && \
|
|
git checkout $CORE_LIGHTNING_GIT_HASH && \
|
|
./configure --enable-static --prefix=/usr && \
|
|
make -j $(nproc) && \
|
|
make install
|
|
|
|
RUN apk add \
|
|
autoconf-archive \
|
|
bind-tools \
|
|
build-base \
|
|
curl-dev \
|
|
libev-dev \
|
|
pkgconf \
|
|
sqlite-dev
|
|
|
|
ARG CLBOSS_GIT_HASH=9c050d61f01ffff4b7b5d295f708569dd71b55d3
|
|
ARG CLBOSS_REPO=https://github.com/ZmnSCPxj/clboss.git
|
|
RUN git clone --recurse-submodules $CLBOSS_REPO /clboss && \
|
|
cd /clboss && \
|
|
git checkout $CLBOSS_GIT_HASH && \
|
|
autoreconf -i && \
|
|
./configure --prefix=/usr && \
|
|
make -j $(nproc) && \
|
|
make install
|
|
|
|
ARG PLUGINS_GIT_HASH=ce078bb74e10b5dea779fcd9fbe77e1d3e72db7a
|
|
ARG PLUGINS_REPO=https://github.com/lightningd/plugins.git
|
|
RUN git clone $PLUGINS_REPO && \
|
|
cd plugins && \
|
|
git checkout $PLUGINS_GIT_HASH
|
|
|
|
RUN apk add \
|
|
cargo \
|
|
rust \
|
|
grpc \
|
|
protobuf \
|
|
protobuf-dev
|
|
|
|
ARG VLS_GIT_HASH=af02dac8b855c361d74234387d288a9591fad1d5
|
|
ARG VLS_REPO=https://gitlab.com/lightning-signer/validating-lightning-signer.git
|
|
RUN git clone $VLS_REPO && \
|
|
cd validating-lightning-signer && \
|
|
git checkout $VLS_GIT_HASH && \
|
|
cargo build --bins -r
|
|
|
|
# final stage with runtime dependencies and pkgs
|
|
FROM --platform=${TARGETPLATFORM:-${BUILDPLATFORM:-linux/amd64}} alpine:3.18 as runner
|
|
|
|
LABEL maintainer.0="Lakshya Singh (@king-11)" \
|
|
maintainer.1="Dev Random (@devrandom01)"
|
|
|
|
RUN apk update && \
|
|
apk add \
|
|
python3 \
|
|
py3-pip \
|
|
postgresql \
|
|
bitcoin-cli \
|
|
pkgconf \
|
|
build-base \
|
|
bind-tools \
|
|
libev-dev \
|
|
curl-dev \
|
|
sqlite-dev
|
|
|
|
ARG LIGHTNINGD_UID=101
|
|
ARG LIGHTNINGD_USER=lightning
|
|
ARG LIGHTNINGD_HOME=/home/${LIGHTNINGD_USER}
|
|
ENV LIGHTNINGD_DATA=${LIGHTNINGD_HOME}/.lightning \
|
|
LIGHTNINGD_RPC_PORT=9835 \
|
|
LIGHTNINGD_PORT=9735 \
|
|
BITCOIND_HOME=/root/.bitcoin
|
|
|
|
RUN mkdir -p /usr/local/src/plugins
|
|
|
|
COPY --from=builder /usr/bin/lightningd /usr/bin/
|
|
COPY --from=builder /usr/bin/lightning-cli /usr/bin/
|
|
COPY --from=builder /usr/bin/lightning-hsmtool /usr/bin/
|
|
COPY --from=builder /usr/libexec/c-lightning /usr/libexec/c-lightning
|
|
COPY --from=builder /usr/share/man/man8 /usr/share/man/man8
|
|
COPY --from=builder /usr/share/doc/c-lightning /usr/share/doc/c-lightning
|
|
COPY --from=builder /usr/bin/clboss /usr/bin/clboss
|
|
COPY --from=builder /build/plugins/summary /usr/local/src/plugins/summary
|
|
COPY --from=builder /build/validating-lightning-signer/target/release/remote_hsmd_socket /usr/libexec/c-lightning/remote_hsmd_socket
|
|
|
|
RUN addgroup -S lightning && adduser -S lightning -G lightning && \
|
|
mkdir -p ${LIGHTNINGD_DATA} && \
|
|
chown -R lightning:lightning ${LIGHTNINGD_DATA}
|
|
|
|
COPY assets/bitcoin.conf "${BITCOIND_HOME}"/bitcoin.conf
|
|
|
|
COPY lightningd/entrypoint.sh /entrypoint.sh
|
|
RUN chmod +x /entrypoint.sh
|
|
|
|
COPY lightningd/healthcheck.sh /healthcheck.sh
|
|
RUN chmod +x /healthcheck.sh
|
|
|
|
VOLUME ["${LIGHTNINGD_DATA}"]
|
|
|
|
RUN mkdir -p "${BITCOIND_HOME}" && \
|
|
chown -R lightning:lightning "${BITCOIND_HOME}"
|
|
|
|
COPY assets/bitcoin.conf "${BITCOIND_HOME}"/bitcoin.conf
|
|
COPY assets/testnet-config /testnet-config
|
|
COPY assets/regtest-config /regtest-config
|
|
|
|
USER lightning
|
|
|
|
RUN pip3 install \
|
|
pyln-client \
|
|
requests \
|
|
packaging
|
|
|
|
HEALTHCHECK --interval=10s --timeout=10s --start-period=15s \
|
|
CMD ["/bin/sh", "-c", "/healthcheck.sh"]
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
CMD ["lightningd"]
|