1
- # ########################
2
- # Polar needs c-lightning compiled with the DEVELOPER=1 flag in order to decrease the
3
- # normal 30 second bitcoind poll interval using the argument --dev-bitcoind-poll=<seconds>.
4
- # When running in regtest, we want to be able to mine blocks and confirm transactions instantly.
5
- # Original Source: https://github.com/ElementsProject/lightning/blob/v24.02.2/Dockerfile
6
- # ########################
7
-
8
- # ########################
9
- # BEGIN ElementsProject/lightning/Dockerfile
10
- # ########################
11
-
12
- # This dockerfile is meant to compile a core-lightning x64 image
13
- # It is using multi stage build:
14
- # * downloader: Download litecoin/bitcoin and qemu binaries needed for core-lightning
15
- # * builder: Compile core-lightning dependencies, then core-lightning itself with static linking
16
- # * final: Copy the binaries required at runtime
17
- # The resulting image uploaded to dockerhub will only contain what is needed for runtime.
18
- # From the root of the repository, run "docker build -t yourimage:yourtag ."
19
- FROM debian:bullseye-slim as downloader
20
-
21
- RUN set -ex \
22
- && apt-get update \
23
- && apt-get install -qq --no-install-recommends ca-certificates dirmngr wget
24
-
25
- WORKDIR /opt
26
-
27
-
28
- ARG BITCOIN_VERSION=22.0
29
- ARG TARBALL_ARCH=x86_64-linux-gnu
30
- ENV TARBALL_ARCH_FINAL=$TARBALL_ARCH
31
- ENV BITCOIN_TARBALL bitcoin-${BITCOIN_VERSION}-${TARBALL_ARCH_FINAL}.tar.gz
32
- ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-$BITCOIN_VERSION/$BITCOIN_TARBALL
33
- ENV BITCOIN_ASC_URL https://bitcoincore.org/bin/bitcoin-core-$BITCOIN_VERSION/SHA256SUMS
34
-
35
- RUN mkdir /opt/bitcoin && cd /opt/bitcoin \
36
- # ################### Polar Modification
37
- # We want to use the base image arch instead of the BUILDARG above so we can build the
38
- # multi-arch image with one command:
39
- # "docker buildx build --platform linux/amd64,linux/arm64 ..."
40
- # ###################
41
- && TARBALL_ARCH_FINAL="$(uname -m)-linux-gnu" \
42
- && BITCOIN_TARBALL=bitcoin-${BITCOIN_VERSION}-${TARBALL_ARCH_FINAL}.tar.gz \
43
- && BITCOIN_URL=https://bitcoincore.org/bin/bitcoin-core-$BITCOIN_VERSION/$BITCOIN_TARBALL \
44
- && BITCOIN_ASC_URL=https://bitcoincore.org/bin/bitcoin-core-$BITCOIN_VERSION/SHA256SUMS \
45
- # ###################
46
- && wget -qO $BITCOIN_TARBALL "$BITCOIN_URL" \
47
- && wget -qO bitcoin "$BITCOIN_ASC_URL" \
48
- && grep $BITCOIN_TARBALL bitcoin | tee SHA256SUMS \
49
- && sha256sum -c SHA256SUMS \
50
- && BD=bitcoin-$BITCOIN_VERSION/bin \
51
- && tar -xzvf $BITCOIN_TARBALL $BD/ --strip-components=1 \
52
- && rm $BITCOIN_TARBALL
53
-
54
- ENV LITECOIN_VERSION 0.16.3
55
- ENV LITECOIN_URL https://download.litecoin.org/litecoin-${LITECOIN_VERSION}/linux/litecoin-${LITECOIN_VERSION}-${TARBALL_ARCH_FINAL}.tar.gz
56
-
57
- # install litecoin binaries
58
- RUN mkdir /opt/litecoin && cd /opt/litecoin \
59
- && wget -qO litecoin.tar.gz "$LITECOIN_URL" \
60
- && tar -xzvf litecoin.tar.gz litecoin-$LITECOIN_VERSION/bin/litecoin-cli --strip-components=1 --exclude=*-qt \
61
- && rm litecoin.tar.gz
62
-
63
- FROM debian:bullseye-slim as builder
64
-
65
- ENV LIGHTNINGD_VERSION=master
66
- RUN apt-get update -qq && \
67
- apt-get install -qq -y --no-install-recommends \
68
- autoconf \
69
- automake \
70
- build-essential \
71
- ca-certificates \
72
- curl \
73
- dirmngr \
74
- gettext \
75
- git \
76
- gnupg \
77
- libpq-dev \
78
- libtool \
79
- libffi-dev \
80
- pkg-config \
81
- libssl-dev \
82
- protobuf-compiler \
83
- python3.9 \
84
- python3-dev \
85
- python3-mako \
86
- python3-pip \
87
- python3-venv \
88
- python3-setuptools \
89
- libev-dev \
90
- libevent-dev \
91
- qemu-user-static \
92
- wget \
93
- jq
94
-
95
- RUN wget -q https://zlib.net/fossils/zlib-1.2.13.tar.gz \
96
- && tar xvf zlib-1.2.13.tar.gz \
97
- && cd zlib-1.2.13 \
98
- && ./configure \
99
- && make \
100
- && make install && cd .. && \
101
- rm zlib-1.2.13.tar.gz && \
102
- rm -rf zlib-1.2.13
103
-
104
- RUN apt-get install -y --no-install-recommends unzip tclsh \
105
- && wget -q https://www.sqlite.org/2019/sqlite-src-3290000.zip \
106
- && unzip sqlite-src-3290000.zip \
107
- && cd sqlite-src-3290000 \
108
- && ./configure --enable-static --disable-readline --disable-threadsafe --disable-load-extension \
109
- && make \
110
- && make install && cd .. && rm sqlite-src-3290000.zip && rm -rf sqlite-src-3290000
111
-
112
- USER root
113
- ENV RUST_PROFILE=release
114
- ENV PATH=$PATH:/root/.cargo/bin/
115
- RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
116
- RUN rustup toolchain install stable --component rustfmt --allow-downgrade
117
-
118
- WORKDIR /opt/lightningd
119
- # ################### Polar Modification
120
- # Pull source code from github instead of a local repo
121
- # Original lines:
122
- # COPY . /tmp/lightning
123
- # RUN git clone --recursive /tmp/lightning . && \
124
- # git checkout $(git --work-tree=/tmp/lightning --git-dir=/tmp/lightning/.git rev-parse HEAD)
125
1
ARG CLN_VERSION
126
- RUN git clone --recursive --branch=v${CLN_VERSION} https://github.com/ElementsProject/lightning .
127
- # ###################
128
-
129
- ENV PYTHON_VERSION=3
130
- RUN curl -sSL https://install.python-poetry.org | python3 -
131
-
132
- RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1
133
-
134
- RUN pip3 install --upgrade pip setuptools wheel
135
- RUN pip3 wheel cryptography
136
- RUN pip3 install grpcio-tools
137
-
138
- RUN /root/.local/bin/poetry export -o requirements.txt --without-hashes --with dev
139
- RUN pip3 install -r requirements.txt
140
-
141
- RUN ./configure --prefix=/tmp/lightning_install --enable-static && \
142
- make && \
143
- /root/.local/bin/poetry run make install
144
-
145
- FROM debian:bullseye-slim as final
2
+ ARG CLN_IMAGE="elementsproject/lightningd:v${CLN_VERSION}"
146
3
147
- RUN apt-get update && \
148
- apt-get install -y --no-install-recommends \
149
- tini \
150
- socat \
151
- inotify-tools \
152
- python3.9 \
153
- python3-pip \
154
- qemu-user-static \
155
- libpq5 && \
156
- apt-get clean && \
157
- rm -rf /var/lib/apt/lists/*
4
+ FROM ${CLN_IMAGE}
158
5
159
- ENV LIGHTNINGD_DATA=/root/.lightning
160
- ENV LIGHTNINGD_RPC_PORT=9835
161
- ENV LIGHTNINGD_PORT=9735
162
- ENV LIGHTNINGD_NETWORK=bitcoin
163
-
164
- RUN mkdir $LIGHTNINGD_DATA && \
165
- touch $LIGHTNINGD_DATA/config
166
- VOLUME [ "/root/.lightning" ]
167
-
168
- COPY --from=builder /tmp/lightning_install/ /usr/local/
169
- COPY --from=builder /usr/local/lib/python3.9/dist-packages/ /usr/local/lib/python3.9/dist-packages/
170
- COPY --from=downloader /opt/bitcoin/bin /usr/bin
171
- COPY --from=downloader /opt/litecoin/bin /usr/bin
172
- # ################### Polar Modification
173
- # This line is removed as we have our own entrypoint file
174
- # Original line:
175
- # COPY tools/docker-entrypoint.sh entrypoint.sh
176
- # ###################
177
-
178
- # ########################
179
- # END ElementsProject/lightning/Dockerfile
180
- # ########################
181
-
182
- COPY --from=builder /opt/lightningd/contrib/lightning-cli.bash-completion /etc/bash_completion.d/
6
+ ARG CLN_VERSION
183
7
184
- # install nodejs
8
+ # install gosu
185
9
RUN apt-get update -y \
186
10
&& apt-get install -y curl gosu git \
187
11
&& apt-get clean \
188
12
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
189
13
14
+ # download CLN bash completion file
15
+ RUN curl -SLO https://raw.githubusercontent.com/ElementsProject/lightning/v${CLN_VERSION}/contrib/lightning-cli.bash-completion \
16
+ && mv lightning-cli.bash-completion /etc/bash_completion.d/lightning-cli
17
+
190
18
# install lightning-cli bash completion
191
19
RUN curl -SLO https://raw.githubusercontent.com/scop/bash-completion/master/bash_completion \
192
20
&& mv bash_completion /usr/share/bash-completion/
@@ -197,7 +25,6 @@ COPY bashrc /home/clightning/.bashrc
197
25
RUN chmod a+x /entrypoint.sh
198
26
199
27
VOLUME ["/home/clightning" ]
200
- VOLUME ["/opt/c-lightning-rest/certs" ]
201
28
202
29
EXPOSE 9735 9835 8080 10000
203
30
0 commit comments