2019-08-29 14:57:44 +02:00
|
|
|
# This dockerfile is meant to compile a c-lightning x64 image
|
|
|
|
# It is using multi stage build:
|
|
|
|
# * downloader: Download litecoin/bitcoin and qemu binaries needed for c-lightning
|
|
|
|
# * builder: Compile c-lightning dependencies, then c-lightning itself with static linking
|
|
|
|
# * final: Copy the binaries required at runtime
|
|
|
|
# The resulting image uploaded to dockerhub will only contain what is needed for runtime.
|
|
|
|
# From the root of the repository, run "docker build -t yourimage:yourtag ."
|
2020-09-14 11:18:49 +02:00
|
|
|
FROM debian:buster-slim as downloader
|
2019-08-29 14:57:44 +02:00
|
|
|
|
|
|
|
RUN set -ex \
|
|
|
|
&& apt-get update \
|
|
|
|
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr wget
|
2018-06-21 17:42:52 +02:00
|
|
|
|
|
|
|
WORKDIR /opt
|
|
|
|
|
2019-08-29 14:57:44 +02:00
|
|
|
RUN wget -qO /opt/tini "https://github.com/krallin/tini/releases/download/v0.18.0/tini" \
|
|
|
|
&& echo "12d20136605531b09a2c2dac02ccee85e1b874eb322ef6baf7561cd93f93c855 /opt/tini" | sha256sum -c - \
|
|
|
|
&& chmod +x /opt/tini
|
|
|
|
|
2021-11-04 19:06:44 +01:00
|
|
|
ARG BITCOIN_VERSION=22.0
|
2018-11-03 01:16:02 +01:00
|
|
|
ENV BITCOIN_TARBALL bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz
|
2018-08-20 10:38:22 +02:00
|
|
|
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-$BITCOIN_VERSION/$BITCOIN_TARBALL
|
2021-11-04 19:06:44 +01:00
|
|
|
ENV BITCOIN_ASC_URL https://bitcoincore.org/bin/bitcoin-core-$BITCOIN_VERSION/SHA256SUMS
|
2018-06-21 17:42:52 +02:00
|
|
|
|
|
|
|
RUN mkdir /opt/bitcoin && cd /opt/bitcoin \
|
2018-08-20 10:38:22 +02:00
|
|
|
&& wget -qO $BITCOIN_TARBALL "$BITCOIN_URL" \
|
2021-11-04 19:06:44 +01:00
|
|
|
&& wget -qO bitcoin "$BITCOIN_ASC_URL" \
|
|
|
|
&& grep $BITCOIN_TARBALL bitcoin | tee SHA256SUMS \
|
|
|
|
&& sha256sum -c SHA256SUMS \
|
2018-06-21 17:42:52 +02:00
|
|
|
&& BD=bitcoin-$BITCOIN_VERSION/bin \
|
2018-08-20 10:38:22 +02:00
|
|
|
&& tar -xzvf $BITCOIN_TARBALL $BD/bitcoin-cli --strip-components=1 \
|
|
|
|
&& rm $BITCOIN_TARBALL
|
2018-06-21 17:42:52 +02:00
|
|
|
|
2018-10-30 20:53:11 +01:00
|
|
|
ENV LITECOIN_VERSION 0.16.3
|
2018-06-21 17:42:52 +02:00
|
|
|
ENV LITECOIN_PGP_KEY FE3348877809386C
|
2018-11-03 01:16:02 +01:00
|
|
|
ENV LITECOIN_URL https://download.litecoin.org/litecoin-${LITECOIN_VERSION}/linux/litecoin-${LITECOIN_VERSION}-x86_64-linux-gnu.tar.gz
|
|
|
|
ENV LITECOIN_ASC_URL https://download.litecoin.org/litecoin-${LITECOIN_VERSION}/linux/litecoin-${LITECOIN_VERSION}-linux-signatures.asc
|
2019-08-29 14:57:44 +02:00
|
|
|
ENV LITECOIN_SHA256 686d99d1746528648c2c54a1363d046436fd172beadaceea80bdc93043805994
|
2018-06-21 17:42:52 +02:00
|
|
|
|
|
|
|
# install litecoin binaries
|
|
|
|
RUN mkdir /opt/litecoin && cd /opt/litecoin \
|
|
|
|
&& wget -qO litecoin.tar.gz "$LITECOIN_URL" \
|
2019-08-29 14:57:44 +02:00
|
|
|
&& echo "$LITECOIN_SHA256 litecoin.tar.gz" | sha256sum -c - \
|
2018-06-21 17:42:52 +02:00
|
|
|
&& BD=litecoin-$LITECOIN_VERSION/bin \
|
|
|
|
&& tar -xzvf litecoin.tar.gz $BD/litecoin-cli --strip-components=1 --exclude=*-qt \
|
|
|
|
&& rm litecoin.tar.gz
|
|
|
|
|
2020-09-14 11:18:49 +02:00
|
|
|
FROM debian:buster-slim as builder
|
2019-08-29 14:57:44 +02:00
|
|
|
|
2018-06-21 17:42:52 +02:00
|
|
|
ENV LIGHTNINGD_VERSION=master
|
2022-01-26 19:11:29 +01:00
|
|
|
RUN apt-get update -qq && \
|
|
|
|
apt-get install -qq -y --no-install-recommends \
|
|
|
|
autoconf \
|
|
|
|
automake \
|
|
|
|
build-essential \
|
|
|
|
ca-certificates \
|
2022-03-01 13:19:19 +01:00
|
|
|
curl \
|
2022-01-26 19:11:29 +01:00
|
|
|
dirmngr \
|
|
|
|
gettext \
|
|
|
|
git \
|
|
|
|
gnupg \
|
|
|
|
libtool \
|
2022-03-01 13:19:19 +01:00
|
|
|
libffi-dev \
|
2022-01-26 19:11:29 +01:00
|
|
|
python3 \
|
2022-03-01 14:28:58 +01:00
|
|
|
python3-dev \
|
2022-01-26 19:11:29 +01:00
|
|
|
python3-mako \
|
|
|
|
python3-pip \
|
2022-03-01 14:28:58 +01:00
|
|
|
python3-venv \
|
2022-01-26 19:11:29 +01:00
|
|
|
python3-setuptools \
|
|
|
|
wget
|
|
|
|
|
2019-09-26 03:54:43 +02:00
|
|
|
RUN wget -q https://zlib.net/zlib-1.2.11.tar.gz \
|
|
|
|
&& tar xvf zlib-1.2.11.tar.gz \
|
|
|
|
&& cd zlib-1.2.11 \
|
|
|
|
&& ./configure \
|
|
|
|
&& make \
|
|
|
|
&& make install && cd .. && rm zlib-1.2.11.tar.gz && rm -rf zlib-1.2.11
|
|
|
|
|
|
|
|
RUN apt-get install -y --no-install-recommends unzip tclsh \
|
2021-01-26 10:12:11 +01:00
|
|
|
&& wget -q https://www.sqlite.org/2019/sqlite-src-3290000.zip \
|
|
|
|
&& unzip sqlite-src-3290000.zip \
|
|
|
|
&& cd sqlite-src-3290000 \
|
2019-09-26 03:54:43 +02:00
|
|
|
&& ./configure --enable-static --disable-readline --disable-threadsafe --disable-load-extension \
|
|
|
|
&& make \
|
2021-01-26 10:12:11 +01:00
|
|
|
&& make install && cd .. && rm sqlite-src-3290000.zip && rm -rf sqlite-src-3290000
|
2019-09-26 03:54:43 +02:00
|
|
|
|
|
|
|
RUN wget -q https://gmplib.org/download/gmp/gmp-6.1.2.tar.xz \
|
|
|
|
&& tar xvf gmp-6.1.2.tar.xz \
|
|
|
|
&& cd gmp-6.1.2 \
|
|
|
|
&& ./configure --disable-assembly \
|
|
|
|
&& make \
|
|
|
|
&& make install && cd .. && rm gmp-6.1.2.tar.xz && rm -rf gmp-6.1.2
|
2018-06-21 17:42:52 +02:00
|
|
|
|
|
|
|
WORKDIR /opt/lightningd
|
2019-02-01 11:58:17 +01:00
|
|
|
COPY . /tmp/lightning
|
|
|
|
RUN git clone --recursive /tmp/lightning . && \
|
|
|
|
git checkout $(git --work-tree=/tmp/lightning --git-dir=/tmp/lightning/.git rev-parse HEAD)
|
2018-06-21 17:42:52 +02:00
|
|
|
ARG DEVELOPER=0
|
2021-01-26 10:12:11 +01:00
|
|
|
ENV PYTHON_VERSION=3
|
2022-03-01 14:28:58 +01:00
|
|
|
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python3 - \
|
|
|
|
&& pip3 install -U pip \
|
|
|
|
&& pip3 install -U wheel \
|
|
|
|
&& /root/.local/bin/poetry config virtualenvs.create false \
|
|
|
|
&& /root/.local/bin/poetry install
|
2021-12-11 15:41:08 +01:00
|
|
|
|
2019-08-29 14:57:44 +02:00
|
|
|
RUN ./configure --prefix=/tmp/lightning_install --enable-static && make -j3 DEVELOPER=${DEVELOPER} && make install
|
|
|
|
|
2020-09-14 11:18:49 +02:00
|
|
|
FROM debian:buster-slim as final
|
2021-01-26 10:12:11 +01:00
|
|
|
|
2019-08-29 14:57:44 +02:00
|
|
|
COPY --from=downloader /opt/tini /usr/bin/tini
|
2020-06-18 14:14:49 +02:00
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends socat inotify-tools python3 python3-pip \
|
2019-08-29 14:57:44 +02:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
2018-06-21 17:42:52 +02:00
|
|
|
|
|
|
|
ENV LIGHTNINGD_DATA=/root/.lightning
|
2018-06-26 02:17:53 +02:00
|
|
|
ENV LIGHTNINGD_RPC_PORT=9835
|
2019-08-29 14:57:44 +02:00
|
|
|
ENV LIGHTNINGD_PORT=9735
|
2020-07-05 14:29:48 +02:00
|
|
|
ENV LIGHTNINGD_NETWORK=bitcoin
|
2018-06-21 17:42:52 +02:00
|
|
|
|
2019-08-29 14:57:44 +02:00
|
|
|
RUN mkdir $LIGHTNINGD_DATA && \
|
|
|
|
touch $LIGHTNINGD_DATA/config
|
2018-06-21 17:42:52 +02:00
|
|
|
VOLUME [ "/root/.lightning" ]
|
2019-03-11 09:51:47 +01:00
|
|
|
COPY --from=builder /tmp/lightning_install/ /usr/local/
|
2019-08-29 14:57:44 +02:00
|
|
|
COPY --from=downloader /opt/bitcoin/bin /usr/bin
|
|
|
|
COPY --from=downloader /opt/litecoin/bin /usr/bin
|
2018-06-21 17:42:52 +02:00
|
|
|
COPY tools/docker-entrypoint.sh entrypoint.sh
|
|
|
|
|
2018-06-26 02:17:53 +02:00
|
|
|
EXPOSE 9735 9835
|
2019-08-29 14:57:44 +02:00
|
|
|
ENTRYPOINT [ "/usr/bin/tini", "-g", "--", "./entrypoint.sh" ]
|