119 lines
3.1 KiB
Docker
119 lines
3.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 GIT_HASH=bd9494c65be09e6f8ecb3bc49b50a859467a65fe
|
|
RUN git clone --recursive https://github.com/lightning-signer/c-lightning.git /repo && \
|
|
cd /repo && \
|
|
git checkout $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 GIT_HASH=4f37007f00f1cf41e2ead031ddc4a34ef8dbd9e5
|
|
RUN git clone --recurse-submodules https://github.com/ZmnSCPxj/clboss.git /clboss && \
|
|
cd /clboss && \
|
|
git checkout $GIT_HASH && \
|
|
autoreconf -i && \
|
|
./configure --prefix=/usr && \
|
|
make -j $(nproc) && \
|
|
make install
|
|
|
|
# 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 \
|
|
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
|
|
|
|
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
|
|
|
|
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
|
|
COPY assets/main-config /main-config
|
|
|
|
USER lightning
|
|
|
|
HEALTHCHECK --interval=10s --timeout=10s --start-period=15s \
|
|
CMD ["/bin/sh", "-c", "/healthcheck.sh"]
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
CMD ["lightningd"]
|