-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
90 lines (69 loc) · 2.62 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
FROM debian:bullseye-slim
ARG HOMEDIR="/root"
ARG RUNPATH="$HOMEDIR/run"
ARG LIBPATH="$RUNPATH/lib"
ARG CLNPATH="$HOMEDIR/.lightning"
## Install dependencies.
RUN apt-get update && apt-get install -y \
curl git iproute2 jq libevent-dev libsodium-dev lsof man netcat \
openssl procps python3 python3-pip qrencode socat xxd neovim
## Install python modules.
RUN pip3 install Flask pyln-client
## Install Node.
RUN curl -fsSL https://deb.nodesource.com/setup_17.x | bash - && apt-get install -y nodejs
## Install node packages.
RUN npm install -g npm yarn clightningjs
## Copy over binaries.
COPY build/out/* /tmp/bin/
WORKDIR /tmp
## Unpack and/or install binaries.
RUN for file in /tmp/bin/*; do \
if ! [ -z "$(echo $file | grep .tar.)" ]; then \
echo "Unpacking $file to /usr ..." \
&& tar --wildcards --strip-components=1 -C /usr -xf $file \
; else \
echo "Moving $file to /usr/local/bin ..." \
&& chmod +x $file && mv $file /usr/local/bin/ \
; fi \
; done
## Clean up temporary files.
RUN rm -rf /tmp/* /var/tmp/*
## Uncomment this if you also want to wipe all repository lists.
#RUN rm -rf /var/lib/apt/lists/*
## Install sparko binary
RUN PLUGPATH="$CLNPATH/plugins" && mkdir -p $PLUGPATH \
&& curl https://github.com/fiatjaf/sparko/releases/download/v2.9/sparko_linux_amd64 \
-fsL#o $PLUGPATH/sparko && chmod +x $PLUGPATH/sparko
## Install RTL REST API.
RUN PLUGPATH="$CLNPATH/plugins" && mkdir -p $PLUGPATH && cd $PLUGPATH \
&& git clone https://github.com/Ride-The-Lightning/c-lightning-REST.git cl-rest \
&& cd cl-rest && npm install
## Configure user account for Tor.
# RUN addgroup tor \
# && adduser --system --no-create-home tor \
# && adduser tor tor \
# && chown -R tor:tor /var/lib/tor /var/log/tor
## Copy configuration and run environment.
COPY config /
COPY run $RUNPATH/
## Add bash aliases to .bashrc.
RUN alias_file="~/.bash_aliases" \
&& printf "if [ -e $alias_file ]; then . $alias_file; fi\n\n" >> $HOMEDIR/.bashrc
## Make sure scripts are executable.
RUN for file in `grep -lr '#!/usr/bin/env' $RUNPATH`; do chmod +x $file; done
## Symlink entrypoint and login to PATH.
RUN ln -s $RUNPATH/entrypoint.sh /usr/local/bin/node-start
## Configure run environment.
ENV PATH="$LIBPATH/bin:$HOMEDIR/.local/bin:$PATH"
ENV PYPATH="$LIBPATH/pylib:$PYPATH"
ENV NODE_PATH="$LIBPATH/nodelib:$NODE_PATH"
ENV RUNPATH="$RUNPATH"
ENV LIBPATH="$LIBPATH"
ENV LOGPATH="/var/log"
ENV ONIONPATH="/data/tor/services"
## Configure Core Lightning Environment
ENV LNPATH="$HOMEDIR/.lightning"
ENV PLUGPATH="$RUNPATH/plugins/"
ENV LNRPCPATH="$LNPATH/regtest/lightning-rpc"
WORKDIR $HOMEDIR
ENTRYPOINT [ "node-start" ]