Skip to content

Commit

Permalink
Dockerfile improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Dec 16, 2020
1 parent 4a981a2 commit db510c8
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 24 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ required-features = ["cli"]
[dependencies]
# LNP/BP crates
amplify = "~2.3.1"
amplify_derive = "~2.3.0"
lnpbp = { version = "=0.2.0-beta.2", features = ["lnp", "url", "websockets"] }
amplify_derive = "~2.3.1"
lnpbp = { version = "=0.2.0-beta.2", features = ["lnp", "websockets"] }
lnpbp_derive = "=0.2.0-beta.2"
lnpbp_services = "=0.2.0-beta.2"
rgb_node = { version = "~0.2.0-beta.2", features = ["client", "fungibles"] }
Expand Down
49 changes: 30 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,48 +1,59 @@
ARG BUILDER_DIR=/srv/lnp


FROM rust:1.47.0-slim-buster as builder

ARG SRC_DIR=/usr/local/src/lnp
ARG BUILDER_DIR

RUN apt-get update -y \
&& apt-get install -y \
libsqlite3-dev \
libssl-dev \
libzmq3-dev \
pkg-config

ENV SRC=/usr/local/src/lnpnode
WORKDIR "$SRC_DIR"

COPY doc ${SRC_DIR}/doc
COPY shell ${SRC_DIR}/shell
COPY src ${SRC_DIR}/src
COPY build.rs Cargo.lock Cargo.toml codecov.yml config_spec.toml \
LICENSE license_header.txt README.md ${SRC_DIR}/

COPY doc ${SRC}/doc
COPY shell ${SRC}/shell
COPY src ${SRC}/src
COPY build.rs Cargo.lock Cargo.toml codecov.yml config_spec.toml LICENSE license_header.txt README.md ${SRC}/
WORKDIR ${SRC_DIR}

WORKDIR ${SRC}
RUN mkdir "${BUILDER_DIR}"

RUN cargo install --path . --bins --all-features
RUN cargo install --path . --root "${BUILDER_DIR}" --bins --all-features


FROM debian:buster-slim

ARG BUILDER_DIR
ARG BIN_DIR=/usr/local/bin
ARG DATA_DIR=/var/lib/lnp
ARG USER=lnpd

RUN apt-get update -y \
&& apt-get install -y \
libzmq3-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

COPY --from=builder /usr/local/cargo/bin/lnp-cli /usr/local/bin/
COPY --from=builder /usr/local/cargo/bin/connectiond /usr/local/bin/

ENV APP_DIR=/srv/app USER=lnpnode
ENV CONF=${APP_DIR}/config.toml

RUN adduser --home ${APP_DIR} --shell /bin/bash --disabled-login \
RUN adduser --home "${DATA_DIR}" --shell /bin/bash --disabled-login \
--gecos "${USER} user" ${USER}

COPY --from=builder --chown=${USER}:${USER} \
"${BUILDER_DIR}/bin/" "${BIN_DIR}"

WORKDIR "${BIN_DIR}"
USER ${USER}

RUN touch ${CONF} \
&& mkdir ${APP_DIR}/.lnp_node
VOLUME "$DATA_DIR"

WORKDIR ${APP_DIR}
EXPOSE 9735

EXPOSE 9666 9735
ENTRYPOINT ["lnpd"]

ENTRYPOINT ["connectiond", "-vvvv", "--listen", "--config=/srv/app/config.toml"]
CMD ["-vvv", "--data-dir", "/var/lib/lnp"]
2 changes: 1 addition & 1 deletion src/bin/gossipd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use lnp::gossipd::{self, Opts};
use lnp::Config;

fn main() {
println!("gossipd: lightning peer network gossip microservice");
println!("gossipd: lightning peer network gossip daemon");

let mut opts = Opts::parse();
trace!("Command-line arguments: {:?}", &opts);
Expand Down

0 comments on commit db510c8

Please sign in to comment.