diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f398b95 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM ubuntu:22.04 + +# Backend +COPY ./deb-files/backend-flo_0.15.1.1-satoshilabs-1_amd64.deb /opt/backend.deb + +RUN apt update && apt install -y /opt/backend.deb +WORKDIR /opt/coins/nodes/flo +RUN sed -i 's/daemon=1/daemon=0/' /opt/coins/nodes/flo/flo.conf + +# Frontend +COPY ./deb-files/blockbook-flo_0.4.0_amd64.deb /opt/blockbook.deb + +RUN apt update && apt install -y /opt/blockbook.deb +WORKDIR /opt/coins/blockbook/flo + +# Execution +COPY ./entrypoint.sh /opt/entrypoint.sh +RUN chmod +x /opt/entrypoint.sh +ENTRYPOINT ["/opt/entrypoint.sh"] diff --git a/README.md b/README.md index f2b6213..c64951c 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,31 @@ ## Roadmap for upgrade -[X] - Create separate images for both backend and blockbook. -[X] - Attach the same volume to both the running containers of the images. -[ ] - Think of how Blockbook container will detect the spots of backend container -[ ] - See if creating a new network for both the containers will be a good option. +- [X] [Unable to build frontend separately since having backend package installed is a dependency] Create separate images for both backend and blockbook. +- [X] Attach the same volume to both the running containers of the images. +- [ ] Think of how Blockbook container will detect the spots of backend container +- [ ] Figure out if multiple volume path need to be mounted +- [ ] See if creating a new network for both the containers will be a good option. + +## Building and running blockbook image + +``` +docker build -f Dockerfile -t vivekteega/blockbook:1.0.0 . + +docker volume create blockbook + +# Run backend in "it" mode +docker run -it --mount source=blockbook,target=/opt -p 38366:38366 -p 8066:8066 vivekteega/blockbook:1.0.0 backend + +# Run backend in daemon mode +docker run -d --mount source=blockbook,target=/ -p 38366:38366 -p 8066:8066 vivekteega/blockbook:1.0.0 backend + +# Run frontend in "it" mode +docker run -it --mount source=blockbook,target=/opt -p 9166:9166 -p 9066:9066 vivekteega/blockbook:1.0.0 frontend + +# Run frontend in it mode +docker run -d --mount source=blockbook,target=/ -p 9166:9166 -p 9066:9066 vivekteega/blockbook:1.0.0 frontend +``` ## Building & running backend image @@ -28,5 +49,3 @@ docker run -it --mount source=blockbook,target=/opt/coins -p 9166:9166 -p 9066:9 docker run -d --mount source=blockbook,target=/opt/coins -p 9166:9166 -p 9066:9066 vivekteega/blockbook-frontend:1.0.0 ``` - - diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..610c96a --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,20 @@ +#!/bin/sh +set -e + +case "$1" in + "frontend") + echo "Running frontend command" + cd /opt/coins/blockbook/flo + exec /opt/coins/blockbook/flo/bin/blockbook -blockchaincfg=/opt/coins/blockbook/flo/config/blockchaincfg.json -datadir=/opt/coins/data/flo/blockbook/db -sync -internal=:9066 -public=:9166 -certfile=/opt/coins/blockbook/flo/cert/blockbook -explorer= -log_dir=/opt/coins/blockbook/flo/logs -dbcache=1073741824 + ;; + "backend") + echo "Running backend command" + cd /opt/coins/nodes/flo + exec /opt/coins/nodes/flo/bin/flod -datadir=/opt/coins/data/flo/backend -conf=/opt/coins/nodes/flo/flo.conf -pid=/run/flo/flo.pid + ;; + *) + echo "Invalid option: $1" + echo "Usage: $0 {frontend|backend}" + exit 1 + ;; +esac