From 12dc60e444040970b402d43969f5f9cd9d535478 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Sun, 11 Oct 2020 01:26:19 +0200 Subject: [PATCH] Updated RGB node docker files --- Dockerfile/rgb-node/Dockerfile | 47 ++++++++++++++++-------- README.md | 14 ++++++- docker-compose/.env | 1 + docker-compose/signet/docker-compose.yml | 21 +++++++++++ 4 files changed, 66 insertions(+), 17 deletions(-) diff --git a/Dockerfile/rgb-node/Dockerfile b/Dockerfile/rgb-node/Dockerfile index c66433f..34896c7 100644 --- a/Dockerfile/rgb-node/Dockerfile +++ b/Dockerfile/rgb-node/Dockerfile @@ -1,40 +1,55 @@ +ARG BUILDER_DIR=/srv/rgb + + FROM rustlang/rust:nightly-slim as builder +ARG SRC_DIR=/usr/local/src/rgb +ARG BUILDER_DIR +ARG VERSION=0.1.0-rc.1 + RUN apt-get update \ && apt-get -y install --no-install-recommends \ build-essential cmake git libpq-dev libssl-dev libzmq3-dev pkg-config -WORKDIR /srv/app - -ENV RGBNODE_VERSION=v0.1.0-beta.4 +WORKDIR "$SRC_DIR" RUN git clone -n https://github.com/LNP-BP/rgb-node.git . \ - && git checkout ${RGBNODE_VERSION} \ - && cargo build --release + && git checkout ${VERSION:+tags/v}${VERSION:-master} -FROM debian:buster-slim +RUN cargo build --release -ENV APP_DIR=/srv/app USER=rgbnode +RUN mkdir "${BUILDER_DIR}" -RUN adduser --home ${APP_DIR} --shell /bin/bash --disabled-login \ - --gecos "${USER} user" ${USER} +RUN cargo install --path . --root "${BUILDER_DIR}" -COPY --from=builder --chown=${USER}:${USER} \ - ${APP_DIR} ${APP_DIR} + +FROM debian:buster-slim + +ARG BUILDER_DIR +ARG BIN_DIR=/usr/local/bin +ARG DATA_DIR=/var/lib/rgb +ARG USER=rgbd RUN apt-get update \ && apt-get -y install --no-install-recommends \ - libssl1.1 tini \ + libssl1.1 \ + tini \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -WORKDIR ${APP_DIR} +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 mkdir data +VOLUME "$DATA_DIR" -VOLUME ["${APP_DIR}/data"] ENTRYPOINT ["/usr/bin/tini", "-g", "--", "/usr/local/bin/rgbd", \ - "--bin-dir", "/usr/local/bin", "--data-dir", "./data"] + "--bin-dir", "/usr/local/bin", "--data-dir", "/var/lib/rgb"] + CMD ["-vvvv"] diff --git a/README.md b/README.md index 30a482d..8f9f1c1 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,13 @@ alias sightning-cli='docker exec lightningd-signet lightning-cli --lightning-dir `docker build Dockerfile/electrs --build-arg VERSION=` - nightly build: `docker build Dockerfile/electrs` +- **RGB Node**: + - latest: + `docker build Dockerfile/rgbd --build-arg` + - version tagged: + `docker build Dockerfile/rgbd --build-arg VERSION=` + - nightly build: + `docker build Dockerfile/rgbd --build-arg VERSION=` #### Bitcoin Core @@ -116,7 +123,12 @@ You can use your existing bitcoin blockchain directory using the following steps --opt o=bind \ --opt type=none \ --opt device=/var/lib/electrs \ - electrs + electrs + docker volume create --driver local \ + --opt o=bind \ + --opt type=none \ + --opt device=/private/var/lib/rgb \ + rgb ``` where `/var/lib/bitcoin` etc must be replaced with your destination directories 2. Edit `docker-compose/.env` file paths diff --git a/docker-compose/.env b/docker-compose/.env index b037546..e9c813f 100644 --- a/docker-compose/.env +++ b/docker-compose/.env @@ -2,3 +2,4 @@ BITCOIN_VOLUME_EXTERNAL=true ELECTRS_VOLUME_EXTERNAL=true LIGHTNING_VOLUME_EXTERNAL=true ELEMENTS_VOLUME_EXTERNAL=true +RGB_VOLUME_EXTERNAL=true diff --git a/docker-compose/signet/docker-compose.yml b/docker-compose/signet/docker-compose.yml index fddd423..0c18d82 100644 --- a/docker-compose/signet/docker-compose.yml +++ b/docker-compose/signet/docker-compose.yml @@ -70,6 +70,25 @@ services: networks: - bitcoinrpc + rgbd-signet: + container_name: rgbd-signet + image: lnpbp/rgbd:0.1.0-rc1 + restart: unless-stopped + depends_on: + - bitcoind-signet + - electrs-signet + environment: + FUNGIBLED_RPC_ENDPOINT: "lnp://{node_id}@0.0.0.0:13015" + command: + - "-vvvv" + # - "--network signet" + ports: + - 13015:13015 + volumes: + - rgb:/var/lib/rgb + networks: + - bitcoinrpc + volumes: bitcoin: external: "${BITCOIN_VOLUME_EXTERNAL:-false}" @@ -77,6 +96,8 @@ volumes: external: "${ELECTRS_VOLUME_EXTERNAL:-false}" lightning: external: "${LIGHTNING_VOLUME_EXTERNAL:-false}" + rgb: + external: "${RGB_VOLUME_EXTERNAL:-false}" networks: bitcoinrpc: