Skip to content

Commit

Permalink
chore: 🤖 run as non-root
Browse files Browse the repository at this point in the history
  • Loading branch information
heldrida committed Oct 26, 2023
1 parent 5d38810 commit 5ee6e8c
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,35 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry \

FROM ubuntu:latest
ARG LIGHTNING_PORTS="4200-4299 4300-4399"
WORKDIR /root
ARG USERNAME="lgtn"
WORKDIR /home/$USERNAME
SHELL ["/bin/bash", "-c"]

RUN apt-get update && \
apt-get install -y \
libssl-dev \
ca-certificates
ca-certificates \
curl

COPY --from=build /build/lightning-node /usr/local/bin/lgtn

COPY <<EOF /root/init
RUN useradd -Um $USERNAME

COPY <<EOF /home/$USERNAME/init
#!/usr/bin/bash

if [[ ! -d /root/.lightning/keystore ]]; then
if [[ ! -d /home/$USERNAME/.lightning/keystore ]]; then
lgtn keys generate
fi

lgtn -vv run
lgtn -c /home/$USERNAME/.lightning/config.toml -vv run
EOF

RUN chmod +x /root/init
RUN chown $USERNAME:$USERNAME /home/$USERNAME/init
RUN chmod +x /home/$USERNAME/init

EXPOSE $LIGHTNING_PORTS

ENTRYPOINT ["/root/init"]
USER $USERNAME

ENTRYPOINT ["/home/lgtn/init"]

0 comments on commit 5ee6e8c

Please sign in to comment.