-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'rust-python-plugin-support' into 'master'
Rust python plugin support Closes #2 See merge request nolim1t/docker-clightning!1
- Loading branch information
Showing
4 changed files
with
89 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,42 +39,55 @@ ARG VERSION | |
ARG REPO | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates autoconf automake build-essential git libtool python3 python3-mako wget gnupg dirmngr git gettext libgmp-dev libsqlite3-dev net-tools zlib1g-dev unzip tclsh git | ||
ARG DEVELOPER=0 | ||
|
||
WORKDIR /opt | ||
RUN git clone $REPO | ||
WORKDIR /opt/lightning | ||
RUN ls -la | ||
RUN mkdir -p /tmp/lightning_install | ||
|
||
RUN git checkout $VERSION | ||
#RUN git clone --recursive /tmp/lightning . && \ | ||
# git checkout $(git --work-tree=/tmp/lightning --git-dir=/tmp/lightning/.git rev-parse HEAD) | ||
|
||
ARG DEVELOPER=0 | ||
RUN ./configure --prefix=/tmp/lightning_install --enable-static && make -j3 DEVELOPER=${DEVELOPER} && make install | ||
RUN git clone $REPO && \ | ||
cd lightning && \ | ||
ls -la && \ | ||
mkdir -p /tmp/lightning_install && \ | ||
ls -la /tmp && \ | ||
git checkout $VERSION && \ | ||
./configure --prefix=/tmp/lightning_install \ | ||
--enable-static && \ | ||
make -j3 DEVELOPER=${DEVELOPER} && \ | ||
make install && \ | ||
ls -la /tmp/lightning_install | ||
|
||
FROM debian:buster-slim as final | ||
ARG USER | ||
ARG DATA | ||
|
||
LABEL maintainer="nolim1t ([email protected])" | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends socat inotify-tools python3 python3-pip \ | ||
RUN apt-get update && apt-get install -y --no-install-recommends git socat inotify-tools python3 python3-pip cargo \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
|
||
COPY --from=builder /lib /lib | ||
COPY --from=builder /tmp/lightning_install/ /usr/local/ | ||
COPY --from=downloader /opt/bin /usr/bin | ||
COPY --from=builder /opt/lightning/tools/docker-entrypoint.sh entrypoint.sh | ||
COPY ./scripts/docker-entrypoint.sh entrypoint.sh | ||
|
||
RUN mkdir /rust-plugin && \ | ||
chown 1000.1000 /rust-plugin | ||
|
||
RUN adduser --disabled-password \ | ||
--home "$DATA" \ | ||
--gecos "" \ | ||
"$USER" | ||
|
||
USER $USER | ||
|
||
# Build and install http rust plugin to the following dir | ||
# /rust-plugin/c-lightning-http-plugin/target/release/c-lightning-http-plugin | ||
RUN cd /rust-plugin && \ | ||
git clone https://github.com/Start9Labs/c-lightning-http-plugin.git && \ | ||
cd c-lightning-http-plugin && \ | ||
cargo build --release && \ | ||
ls -la target/release/c-lightning-http-plugin && \ | ||
pwd | ||
|
||
|
||
ENV LIGHTNINGD_DATA=$DATA/.lightning | ||
ENV LIGHTNINGD_RPC_PORT=9835 | ||
ENV LIGHTNINGD_PORT=9735 | ||
|
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Original file (Upstream) | ||
# https://raw.githubusercontent.com/ElementsProject/lightning/master/tools/docker-entrypoint.sh | ||
# modified to include plugin path for building my custom container | ||
|
||
: "${EXPOSE_TCP:=false}" | ||
|
||
networkdatadir="${LIGHTNINGD_DATA}/${LIGHTNINGD_NETWORK}" | ||
HTTP_RPC_PLUGIN_PATH="/rust-plugin/c-lightning-http-plugin/target/release/c-lightning-http-plugin" | ||
|
||
if [ "$EXPOSE_TCP" == "true" ]; then | ||
set -m | ||
lightningd --plugin="${HTTP_RPC_PLUGIN_PATH}" "$@" & | ||
|
||
echo "C-Lightning starting" | ||
while read -r i; do if [ "$i" = "lightning-rpc" ]; then break; fi; done \ | ||
< <(inotifywait -e create,open --format '%f' --quiet "${networkdatadir}" --monitor) | ||
echo "C-Lightning started" | ||
echo "C-Lightning started, RPC available on port $LIGHTNINGD_RPC_PORT" | ||
|
||
socat "TCP4-listen:$LIGHTNINGD_RPC_PORT,fork,reuseaddr" "UNIX-CONNECT:${networkdatadir}/lightning-rpc" & | ||
fg %- | ||
else | ||
exec lightningd --network="${LIGHTNINGD_NETWORK}" --plugin="${HTTP_RPC_PLUGIN_PATH}" "$@" | ||
fi |