From 1eddbd86a3ea64056db57a2ad2e31fee71a13d72 Mon Sep 17 00:00:00 2001 From: Alex Grintsvayg Date: Mon, 4 Nov 2019 18:17:41 -0500 Subject: [PATCH] simplify tags and Dockerfile name --- ...ockerfile-linux-x86_64-production => Dockerfile} | 5 ++++- lbrycrd/README.md | 13 +++++-------- lbrycrd/compose/docker-compose.yml-regtest | 2 +- lbrycrd/compose/docker-compose.yml-testnet | 2 +- lbrycrd/deploy.sh | 4 +++- lbrycrd/stuff/start.sh | 2 +- 6 files changed, 15 insertions(+), 13 deletions(-) rename lbrycrd/{Dockerfile-linux-x86_64-production => Dockerfile} (86%) diff --git a/lbrycrd/Dockerfile-linux-x86_64-production b/lbrycrd/Dockerfile similarity index 86% rename from lbrycrd/Dockerfile-linux-x86_64-production rename to lbrycrd/Dockerfile index 6e52e23..4e0e294 100644 --- a/lbrycrd/Dockerfile-linux-x86_64-production +++ b/lbrycrd/Dockerfile @@ -11,7 +11,10 @@ COPY ./stuff/start.sh start COPY ./stuff/healthcheck.sh healthcheck COPY ./stuff/advance_blocks.sh advance COPY ./stuff/fix-permissions.c fix-permissions.c -RUN curl --progress-bar -L -o ./lbrycrd-linux.zip $(curl -s https://api.github.com/repos/lbryio/lbrycrd/releases | grep -F 'lbrycrd-linux' | grep download | head -n 1 | cut -d'"' -f4) && \ +ARG release_url +# require that release_url is set +RUN test -n "$release_url" +RUN curl --progress-bar -L -o ./lbrycrd-linux.zip "$release_url" && \ unzip ./lbrycrd-linux.zip && \ gcc fix-permissions.c -o fix-permissions && \ chmod +x ./lbrycrdd ./lbrycrd-cli ./lbrycrd-tx ./start ./healthcheck ./fix-permissions ./advance diff --git a/lbrycrd/README.md b/lbrycrd/README.md index 7485f7e..bf5f26c 100644 --- a/lbrycrd/README.md +++ b/lbrycrd/README.md @@ -1,8 +1,5 @@ -# lbrycrd -# Docker image tags -`lbry/lbrycrd` -`[linux-x86_64-production](https://github.com/lbryio/lbry-docker/blob/master/lbrycrd/Dockerfile-linux-x86_64-production)` (Latest release) - +# lbrycrd Docker image +` ## Configuration @@ -31,18 +28,18 @@ mounted config file exists, these variables are used to create a fresh config. Running the default configuration: ``` -docker run --rm -it -e RUN_MODE=default -e SNAPSHOT_URL="https://lbry.com/snapshot/blockchain" lbry/lbrycrd:linux-x86_64-production +docker run --rm -it -e RUN_MODE=default -e SNAPSHOT_URL="https://lbry.com/snapshot/blockchain" lbry/lbrycrd:latest-release ``` Running with RPC password changed: ``` -docker run --rm -it -e RUN_MODE=default -e RPC_PASSWORD=hunter2 lbry/lbrycrd:linux-x86_64-production +docker run --rm -it -e RUN_MODE=default -e RPC_PASSWORD=hunter2 lbry/lbrycrd:latest-release ``` Running with a config file but with the RPC password still overridden: ``` -docker run --rm -it -v /path/to/lbrycrd.conf:/etc/lbry/lbrycrd.conf -e RUN_MODE=default -e RPC_PASSWORD=hunter2 lbry/lbrycrd:linux-x86_64-production +docker run --rm -it -v /path/to/lbrycrd.conf:/etc/lbry/lbrycrd.conf -e RUN_MODE=default -e RPC_PASSWORD=hunter2 lbry/lbrycrd:latest-release ``` diff --git a/lbrycrd/compose/docker-compose.yml-regtest b/lbrycrd/compose/docker-compose.yml-regtest index 5868e32..d2ea479 100644 --- a/lbrycrd/compose/docker-compose.yml-regtest +++ b/lbrycrd/compose/docker-compose.yml-regtest @@ -11,7 +11,7 @@ services: lbrycrd: build: context: . - dockerfile: Dockerfile-linux-x86_64-production + dockerfile: Dockerfile restart: always ports: - "11336:29246" diff --git a/lbrycrd/compose/docker-compose.yml-testnet b/lbrycrd/compose/docker-compose.yml-testnet index 9bf4bdc..5653ab7 100644 --- a/lbrycrd/compose/docker-compose.yml-testnet +++ b/lbrycrd/compose/docker-compose.yml-testnet @@ -5,7 +5,7 @@ services: ## Lbrycrd ## ############# lbrycrd: - image: lbry/lbrycrd:linux-x86_64-production + image: lbry/lbrycrd:latest-release restart: always ports: - "11336:9246" diff --git a/lbrycrd/deploy.sh b/lbrycrd/deploy.sh index 50bab27..092fd7f 100755 --- a/lbrycrd/deploy.sh +++ b/lbrycrd/deploy.sh @@ -27,5 +27,7 @@ fi DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -docker build -t "lbry/lbrycrd:${docker_tag}" -f Dockerfile-linux-x86_64-production "$DIR" +release_url=$(curl -s https://api.github.com/repos/lbryio/lbrycrd/releases | grep -F 'lbrycrd-linux' | grep download | head -n 1 | cut -d'"' -f4) + +docker build --build-arg "release_url=$release_url" --tag "lbry/lbrycrd:${docker_tag}" -f Dockerfile "$DIR" docker push "lbry/lbrycrd:${docker_tag}" diff --git a/lbrycrd/stuff/start.sh b/lbrycrd/stuff/start.sh index e263428..cfcabd4 100755 --- a/lbrycrd/stuff/start.sh +++ b/lbrycrd/stuff/start.sh @@ -68,7 +68,7 @@ function download_snapshot() { local url="${SNAPSHOT_URL:-}" #off by default. latest snapshot at https://lbry.com/snapshot/blockchain if [[ -n "$url" ]] && [[ ! -d ./.lbrycrd/blocks ]]; then echo "Downloading blockchain snapshot from $url" - wget -O snapshot.tar.bz2 "$url" + wget --no-verbose -O snapshot.tar.bz2 "$url" echo "Extracting snapshot..." mkdir -p ./.lbrycrd tar xvjf snapshot.tar.bz2 --directory ./.lbrycrd