This repository has been archived by the owner on Oct 2, 2023. It is now read-only.
generated from runcitadel/docker-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
135 lines (97 loc) · 3.07 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
ARG REPO=https://github.com/ElementsProject/lightning.git
ARG VERSION=v22.11.1
ARG USER=lightning
ARG DATA=/data
FROM debian:bullseye as downloader
ARG REPO
ARG VERSION
RUN set -ex \
&& apt update \
&& apt install -y -qq --no-install-recommends ca-certificates dirmngr wget
WORKDIR /opt
# Fetch and verify bitcoin (As per arch)
COPY ./fetch-scripts/fetch-bitcoin.sh .
RUN chmod 755 fetch-bitcoin.sh
RUN ./fetch-bitcoin.sh
FROM rust:1.66-slim-bullseye as builder
ARG VERSION
ARG REPO
RUN apt update && \
apt install -qq -y --no-install-recommends \
autoconf \
automake \
build-essential \
ca-certificates \
curl \
dirmngr \
gettext \
git \
gnupg \
libpq-dev \
zlib1g-dev \
libsodium-dev \
libsqlite3-dev \
libgmp-dev \
libtool \
libffi-dev \
python3 \
python3-dev \
python3-mako \
python3-pip \
protobuf-compiler \
wget
WORKDIR /opt/lightningd
COPY . /tmp/lightning
RUN git clone --recursive $REPO . && \
git checkout $VERSION
ARG DEVELOPER=0
RUN python3 -m pip install mako mrkd mistune==0.8.4
RUN rustup component add rustfmt
RUN ./configure --prefix=/tmp/lightning_install --enable-static --enable-rust
RUN make -j$(nproc) DEVELOPER=${DEVELOPER}
RUN make install
WORKDIR /cln-init
RUN git clone --recursive https://github.com/runcitadel/cln-init .
RUN cargo build --release
FROM node:18-bullseye as node-builder
WORKDIR /rest-plugin
RUN git clone https://github.com/Ride-the-Lightning/c-lightning-REST.git . && \
yarn
WORKDIR /sparko-plugin
RUN git clone --recursive https://github.com/fiatjaf/sparko.git . && \
make spark-wallet/client/dist/app.js
FROM golang:1.17 as go-builder
RUN go get github.com/mitchellh/gox
WORKDIR /graphql-plugin
RUN git clone https://github.com/nettijoe96/c-lightning-graphql.git . && \
go build -o c-lightning-graphql
COPY --from=node-builder /sparko-plugin /sparko-plugin
WORKDIR /sparko-plugin
RUN PATH=${HOME}/go/bin:$PATH make dist
FROM node:18-bullseye-slim as final
RUN apt update && apt install -y --no-install-recommends inotify-tools libpq5 libsodium23 openssl \
&& rm -rf /var/lib/apt/lists/*
ARG USER
ARG DATA
COPY --from=builder /lib /lib
COPY --from=builder /tmp/lightning_install/ /usr/local/
COPY --from=builder /cln-init/target/release/cln-initd /usr/bin/
COPY --from=builder /cln-init/target/release/cln-init-cli /usr/bin/
COPY --from=node-builder /rest-plugin /rest-plugin
COPY --from=go-builder /graphql-plugin/c-lightning-graphql /graphql-plugin
COPY --from=go-builder /sparko-plugin/dist /sparko-plugin
COPY --from=downloader /opt/bin /usr/bin
COPY ./scripts/docker-entrypoint.sh entrypoint.sh
RUN userdel -r node
RUN adduser --disabled-password \
--home "$DATA" \
--gecos "" \
"$USER"
RUN chown -R $USER /sparko-plugin
USER $USER
ENV LIGHTNINGD_DATA=$DATA/.lightning
ENV LIGHTNINGD_RPC_PORT=9835
ENV LIGHTNINGD_PORT=9735
ENV LIGHTNINGD_NETWORK=bitcoin
EXPOSE 9735 9736 9835 9836 19735 19736 19835 19836
ENTRYPOINT [ "./entrypoint.sh" ]