forked from fleek-network/lightning
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
70 lines (53 loc) · 1.57 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
# syntax=docker/dockerfile:1.3-labs
# The Fleek Network Lightning Docker container is hosted at:
# https://github.com/fleek-network/lightning/pkgs/container/lightning
FROM rust:latest as build
WORKDIR /build
RUN apt-get update
RUN apt-get install -y \
build-essential \
cmake \
clang \
pkg-config \
libssl-dev \
gcc \
protobuf-compiler
RUN --mount=type=cache,target=/usr/local/cargo/registry \
cargo install cargo-strip
COPY . .
ENV RUST_BACKTRACE=1
RUN mkdir -p /build/target/release
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/build/target \
rustup toolchain install stable && \
rustup default stable && \
cargo +stable install --locked --path core/cli --features services && \
cargo strip && \
cp /usr/local/cargo/bin/lightning-node /build
FROM ubuntu:latest
ARG LIGHTNING_PORTS="4200-4299 4300-4399"
ARG USERNAME="lgtn"
WORKDIR /home/$USERNAME
SHELL ["/bin/bash", "-c"]
RUN apt-get update && \
apt-get install -y \
libssl-dev \
ca-certificates \
curl
COPY --from=build /build/lightning-node /usr/local/bin/lgtn
RUN useradd -Um $USERNAME
COPY <<EOF /home/$USERNAME/init
#!/usr/bin/bash
if [[ ! -d /home/$USERNAME/.lightning/keystore ]]; then
lgtn keys generate
fi
if ! yes | lgtn opt ${OPT:-in}; then
echo "Oops! Failed to set network participation"
fi
lgtn -c /home/$USERNAME/.lightning/config.toml -vv run
EOF
RUN chown $USERNAME:$USERNAME /home/$USERNAME/init
RUN chmod +x /home/$USERNAME/init
EXPOSE $LIGHTNING_PORTS
USER $USERNAME
ENTRYPOINT ["/home/lgtn/init"]