1
- FROM alpine:3.7 as builder
2
-
3
- RUN apk add --no-cache \
4
- ca-certificates \
5
- autoconf \
6
- automake \
7
- build-base \
8
- libressl \
9
- libtool \
10
- gmp-dev \
11
- python \
12
- python-dev \
13
- python3 \
14
- py3-mako \
15
- sqlite-dev \
16
- wget \
17
- git \
18
- file \
19
- gnupg \
20
- swig \
21
- zlib-dev
1
+ # This dockerfile is meant to compile a c-lightning x64 image
2
+ # It is using multi stage build:
3
+ # * downloader: Download litecoin/bitcoin and qemu binaries needed for c-lightning
4
+ # * builder: Compile c-lightning dependencies, then c-lightning itself with static linking
5
+ # * final: Copy the binaries required at runtime
6
+ # The resulting image uploaded to dockerhub will only contain what is needed for runtime.
7
+ # From the root of the repository, run "docker build -t yourimage:yourtag ."
8
+ FROM debian:stretch-slim as downloader
9
+
10
+ RUN set -ex \
11
+ && apt-get update \
12
+ && apt-get install -qq --no-install-recommends ca-certificates dirmngr wget
22
13
23
14
WORKDIR /opt
24
15
16
+ RUN wget -qO /opt/tini "https://github.com/krallin/tini/releases/download/v0.18.0/tini" \
17
+ && echo "12d20136605531b09a2c2dac02ccee85e1b874eb322ef6baf7561cd93f93c855 /opt/tini" | sha256sum -c - \
18
+ && chmod +x /opt/tini
19
+
25
20
ARG BITCOIN_VERSION=0.17.0
26
21
ENV BITCOIN_TARBALL bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz
27
22
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-$BITCOIN_VERSION/$BITCOIN_TARBALL
28
23
ENV BITCOIN_ASC_URL https://bitcoincore.org/bin/bitcoin-core-$BITCOIN_VERSION/SHA256SUMS.asc
29
- ENV BITCOIN_PGP_KEY 01EA5486DE18A882D4C2684590C8019E36C2E964
30
24
31
25
RUN mkdir /opt/bitcoin && cd /opt/bitcoin \
32
26
&& wget -qO $BITCOIN_TARBALL "$BITCOIN_URL" \
33
- && gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys "$BITCOIN_PGP_KEY" \
34
27
&& wget -qO bitcoin.asc "$BITCOIN_ASC_URL" \
35
- && gpg --verify bitcoin.asc \
36
28
&& grep $BITCOIN_TARBALL bitcoin.asc | tee SHA256SUMS.asc \
37
29
&& sha256sum -c SHA256SUMS.asc \
38
30
&& BD=bitcoin-$BITCOIN_VERSION/bin \
@@ -43,62 +35,67 @@ ENV LITECOIN_VERSION 0.16.3
43
35
ENV LITECOIN_PGP_KEY FE3348877809386C
44
36
ENV LITECOIN_URL https://download.litecoin.org/litecoin-${LITECOIN_VERSION}/linux/litecoin-${LITECOIN_VERSION}-x86_64-linux-gnu.tar.gz
45
37
ENV LITECOIN_ASC_URL https://download.litecoin.org/litecoin-${LITECOIN_VERSION}/linux/litecoin-${LITECOIN_VERSION}-linux-signatures.asc
38
+ ENV LITECOIN_SHA256 686d99d1746528648c2c54a1363d046436fd172beadaceea80bdc93043805994
46
39
47
40
# install litecoin binaries
48
41
RUN mkdir /opt/litecoin && cd /opt/litecoin \
49
42
&& wget -qO litecoin.tar.gz "$LITECOIN_URL" \
50
- && gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys "$LITECOIN_PGP_KEY" \
51
- && wget -qO litecoin.asc "$LITECOIN_ASC_URL" \
52
- && gpg --verify litecoin.asc \
43
+ && echo "$LITECOIN_SHA256 litecoin.tar.gz" | sha256sum -c - \
53
44
&& BD=litecoin-$LITECOIN_VERSION/bin \
54
45
&& tar -xzvf litecoin.tar.gz $BD/litecoin-cli --strip-components=1 --exclude=*-qt \
55
46
&& rm litecoin.tar.gz
56
47
48
+ FROM debian:stretch-slim as builder
49
+
57
50
ENV LIGHTNINGD_VERSION=master
51
+ RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates autoconf automake build-essential git libtool python python3 python3-mako wget gnupg dirmngr git
52
+
53
+ RUN wget -q https://zlib.net/zlib-1.2.11.tar.gz \
54
+ && tar xvf zlib-1.2.11.tar.gz \
55
+ && cd zlib-1.2.11 \
56
+ && ./configure \
57
+ && make \
58
+ && make install && cd .. && rm zlib-1.2.11.tar.gz && rm -rf zlib-1.2.11
59
+
60
+ RUN apt-get install -y --no-install-recommends unzip tclsh \
61
+ && wget -q https://www.sqlite.org/2018/sqlite-src-3260000.zip \
62
+ && unzip sqlite-src-3260000.zip \
63
+ && cd sqlite-src-3260000 \
64
+ && ./configure --enable-static --disable-readline --disable-threadsafe --disable-load-extension \
65
+ && make \
66
+ && make install && cd .. && rm sqlite-src-3260000.zip && rm -rf sqlite-src-3260000
67
+
68
+ RUN wget -q https://gmplib.org/download/gmp/gmp-6.1.2.tar.xz \
69
+ && tar xvf gmp-6.1.2.tar.xz \
70
+ && cd gmp-6.1.2 \
71
+ && ./configure --disable-assembly \
72
+ && make \
73
+ && make install && cd .. && rm gmp-6.1.2.tar.xz && rm -rf gmp-6.1.2
58
74
59
75
WORKDIR /opt/lightningd
60
76
COPY . /tmp/lightning
61
77
RUN git clone --recursive /tmp/lightning . && \
62
78
git checkout $(git --work-tree=/tmp/lightning --git-dir=/tmp/lightning/.git rev-parse HEAD)
63
79
64
80
ARG DEVELOPER=0
65
- RUN ./configure --prefix=/tmp/lightning_install && make -j3 DEVELOPER=${DEVELOPER} && make install
66
-
67
- FROM alpine:3.7
68
-
69
- RUN apk add --no-cache \
70
- gmp-dev \
71
- sqlite-dev \
72
- inotify-tools \
73
- socat \
74
- bash \
75
- zlib-dev \
76
- tini
77
-
78
- ENV GLIBC_VERSION 2.27-r0
79
- ENV GLIBC_SHA256 938bceae3b83c53e7fa9cc4135ce45e04aae99256c5e74cf186c794b97473bc7
80
- ENV GLIBCBIN_SHA256 3a87874e57b9d92e223f3e90356aaea994af67fb76b71bb72abfb809e948d0d6
81
- # Download and install glibc (https://github.com/jeanblanchard/docker-alpine-glibc/blob/master/Dockerfile)
82
- RUN apk add --update curl && \
83
- curl -Lo /etc/apk/keys/sgerrand.rsa.pub https://github.com/sgerrand/alpine-pkg-glibc/releases/download/$GLIBC_VERSION/sgerrand.rsa.pub && \
84
- curl -Lo glibc.apk "https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk" && \
85
- echo "$GLIBC_SHA256 glibc.apk" | sha256sum -c - && \
86
- curl -Lo glibc-bin.apk "https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-bin-${GLIBC_VERSION}.apk" && \
87
- echo "$GLIBCBIN_SHA256 glibc-bin.apk" | sha256sum -c - && \
88
- apk add glibc-bin.apk glibc.apk && \
89
- /usr/glibc-compat/sbin/ldconfig /lib /usr/glibc-compat/lib && \
90
- echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf && \
91
- apk del curl && \
92
- rm -rf glibc.apk glibc-bin.apk /var/cache/apk/*
81
+ RUN ./configure --prefix=/tmp/lightning_install --enable-static && make -j3 DEVELOPER=${DEVELOPER} && make install
82
+
83
+ FROM debian:stretch-slim as final
84
+ COPY --from=downloader /opt/tini /usr/bin/tini
85
+ RUN apt-get update && apt-get install -y --no-install-recommends socat inotify-tools \
86
+ && rm -rf /var/lib/apt/lists/*
93
87
94
88
ENV LIGHTNINGD_DATA=/root/.lightning
95
89
ENV LIGHTNINGD_RPC_PORT=9835
90
+ ENV LIGHTNINGD_PORT=9735
96
91
92
+ RUN mkdir $LIGHTNINGD_DATA && \
93
+ touch $LIGHTNINGD_DATA/config
97
94
VOLUME [ "/root/.lightning" ]
98
95
COPY --from=builder /tmp/lightning_install/ /usr/local/
99
- COPY --from=builder /opt/bitcoin/bin /usr/bin
100
- COPY --from=builder /opt/litecoin/bin /usr/bin
96
+ COPY --from=downloader /opt/bitcoin/bin /usr/bin
97
+ COPY --from=downloader /opt/litecoin/bin /usr/bin
101
98
COPY tools/docker-entrypoint.sh entrypoint.sh
102
99
103
100
EXPOSE 9735 9835
104
- ENTRYPOINT [ "/sbin /tini" , "-g" , "--" , "./entrypoint.sh" ]
101
+ ENTRYPOINT [ "/usr/bin /tini" , "-g" , "--" , "./entrypoint.sh" ]
0 commit comments