Last active
March 2, 2025 09:46
-
-
Save king-11/764dcdb2939c4e4b157297ea3277f335 to your computer and use it in GitHub Desktop.
core lightning vanilla image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# build stage for core lightning and its plugins | |
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 \ | |
jq \ | |
libsodium \ | |
libtool \ | |
net-tools \ | |
postgresql-dev \ | |
py3-mako \ | |
py3-pip \ | |
py3-grpcio \ | |
python3 \ | |
python3-dev \ | |
sqlite-dev \ | |
sqlite-static \ | |
zlib-dev \ | |
zlib-static \ | |
linux-headers | |
RUN pip install --upgrade pip packaging | |
ARG CORE_LIGHTNING_GIT_HASH \ | |
CORE_LIGHTNING_REPO | |
RUN git clone --recursive $CORE_LIGHTNING_REPO core-lightning | |
RUN cd core-lightning && \ | |
git checkout $CORE_LIGHTNING_GIT_HASH && \ | |
./configure --enable-static --prefix=/usr && \ | |
make -j $(nproc) install && \ | |
make clean | |
ARG CLN_PLUGINS_GIT_HASH \ | |
CLN_PLUGINS_REPO | |
RUN git clone $CLN_PLUGINS_REPO | |
RUN cd plugins && \ | |
git checkout $CLN_PLUGINS_GIT_HASH && \ | |
git submodule update --init --recursive | |
# Build summars plugin | |
RUN cd plugins/summars && \ | |
cargo install --locked --path . --bin summars --profile release --root /usr/local/ && \ | |
cargo clean | |
FROM --platform=${TARGETPLATFORM:-${BUILDPLATFORM:-linux/amd64}} alpine:3.18 AS clboss_builder | |
WORKDIR /build | |
RUN apk update && \ | |
apk add \ | |
git \ | |
autoconf-archive \ | |
automake \ | |
bind-tools \ | |
build-base \ | |
curl-dev \ | |
libev-dev \ | |
libtool \ | |
libunwind-dev \ | |
pkgconf \ | |
sqlite-dev | |
ARG CLBOSS_GIT_HASH \ | |
CLBOSS_REPO | |
RUN git clone --recurse-submodules $CLBOSS_REPO clboss | |
RUN cd clboss && \ | |
git checkout $CLBOSS_GIT_HASH && \ | |
autoreconf -i && \ | |
./configure --disable-exception-backtrace --prefix=/usr && \ | |
make -j $(nproc) && \ | |
make -j $(nproc) install && \ | |
make clean | |
# 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 \ | |
tini \ | |
python3-dev \ | |
libffi-dev | |
ARG LIGHTNINGD_UID=101 \ | |
LIGHTNINGD_USER=clightning | |
ARG LIGHTNINGD_HOME=/home/${LIGHTNINGD_USER} | |
ENV LIGHTNINGD_DATA=${LIGHTNINGD_HOME}/.lightning | |
RUN mkdir -p /usr/local/src/plugins | |
COPY --from=builder /usr/bin/lightningd /usr/bin/lightning-cli /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=clboss_builder /usr/bin/clboss /usr/bin/clboss | |
COPY --from=builder /build/plugins/monitor/monitor.py /usr/local/src/plugins/monitor.py | |
COPY --from=builder /usr/local/bin/summars /usr/local/src/plugins/summars | |
RUN addgroup -S ${LIGHTNINGD_USER} && adduser -S ${LIGHTNINGD_USER} -G ${LIGHTNINGD_USER} && \ | |
mkdir -p ${LIGHTNINGD_DATA} && \ | |
chown -R ${LIGHTNINGD_USER}:${LIGHTNINGD_USER} ${LIGHTNINGD_DATA} | |
COPY entrypoint.sh /entrypoint.sh | |
RUN chmod +x /entrypoint.sh | |
COPY healthcheck.sh /healthcheck.sh | |
RUN chmod +x /healthcheck.sh | |
VOLUME ["${LIGHTNINGD_HOME}"] | |
COPY regtest-config /regtest-config | |
USER ${LIGHTNINGD_USER} | |
RUN pip3 install --user \ | |
pyln-client \ | |
requests \ | |
packaging | |
# cln rest dependencies | |
RUN pip3 install --user json5 flask flask-restx gunicorn pyln-client flask-socketio gevent gevent-websocket flask-cors | |
EXPOSE 9735 9835 8080 10000 | |
HEALTHCHECK --interval=5s --timeout=10s --start-period=5s \ | |
CMD ["/healthcheck.sh"] | |
ENTRYPOINT ["/sbin/tini", "--", "/entrypoint.sh"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
cp -u /regtest-config ${LIGHTNINGD_DATA}/regtest-config | |
if [ $(echo "$1" | cut -c1) = "-" ]; then | |
echo "$0: assuming arguments for lightningd" | |
set -- lightningd "$@" | |
fi | |
echo | |
exec "$@" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -ex | |
lightning-cli --network regtest getinfo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
important-plugin=/usr/bin/clboss | |
clboss-auto-close=true | |
plugin=/usr/local/src/plugins/summars | |
plugin=/usr/local/src/plugins/monitor.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment