diff --git a/Jenkinsfile b/Jenkinsfile index 2cae161..efec418 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,8 +4,12 @@ pipeline { stage('docker build') { steps { ansiColor('xterm') { - dir('images/') { - sh 'make' + dir('images/lisk/') { + sh ''' + LATEST=$( curl --silent --show-error https://downloads.lisk.io/lisk/development/latest.txt ) + make tag=$LATEST development + docker tag lisk/development:$LATEST lisk/development:latest + ''' } } } @@ -13,7 +17,7 @@ pipeline { stage('smoke tests') { steps { ansiColor('xterm') { - dir('examples/testnet/') { + dir('examples/development/') { sh 'make' retry(3) { sleep 10 @@ -31,7 +35,7 @@ pipeline { post { always { ansiColor('xterm') { - dir('examples/testnet/') { + dir('examples/development/') { sh 'make mrproper' } } diff --git a/README.md b/README.md index 32b8f80..07994c8 100644 --- a/README.md +++ b/README.md @@ -23,19 +23,19 @@ Install `make` on your system. ### Build the images -Decide which image you want to build and run: +Decide which flavour and version you want to build and run: -`make -C images ` +`make tag= -C images/lisk ` -E.g. to build the testnet image: +E.g. to build the testnet 0.9.14a image: ``` -make -C images testnet +make tag=0.9.14a -C images/lisk testnet ``` ### Run images using docker-compose -There are examples for testnet and mainnet in the `examples/`directory. +There are examples for development, betanet, testnet and mainnet in the `examples/`directory. #### Examples for testnet diff --git a/examples/betanet/docker-compose.yml b/examples/betanet/docker-compose.yml index 3ca6c99..f339042 100644 --- a/examples/betanet/docker-compose.yml +++ b/examples/betanet/docker-compose.yml @@ -2,7 +2,7 @@ version: "2" services: lisk: - image: lisk/betanet:next + image: lisk/betanet:latest volumes: - lisk-logs:/home/lisk/lisk/logs/ ports: diff --git a/examples/development/.env b/examples/development/.env index ab443f0..3da2db0 100644 --- a/examples/development/.env +++ b/examples/development/.env @@ -1 +1 @@ -LISK_VERSION=next +LISK_VERSION=latest diff --git a/images/Makefile b/images/Makefile deleted file mode 100644 index 2863998..0000000 --- a/images/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -all: testnet mainnet - -%: - make -C lisk $@ diff --git a/images/lisk/Dockerfile b/images/lisk/Dockerfile index c30b977..7a99f99 100644 --- a/images/lisk/Dockerfile +++ b/images/lisk/Dockerfile @@ -1,10 +1,9 @@ FROM ubuntu:16.04 -ARG network=testnet +ARG tag RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get --assume-yes install --no-install-recommends \ - curl sudo unzip wget zip \ jq moreutils && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* @@ -13,8 +12,9 @@ RUN groupadd --gid 1100 lisk && \ useradd lisk --create-home --home-dir /home/lisk --shell /bin/bash --uid 1100 --gid 1100 # the chown flag does not work with tarballs -ADD ${network}-lisk-Linux-x86_64.tar.gz /home/lisk/ -RUN chown lisk:lisk --recursive /home/lisk/lisk-Linux-x86_64 +ADD lisk-${tag}-Linux-x86_64.tar.gz /home/lisk/ +RUN ln -s lisk-${tag}-Linux-x86_64 /home/lisk/lisk-Linux-x86_64 && \ + chown lisk:lisk --recursive /home/lisk/lisk-Linux-x86_64/ COPY --chown=lisk:lisk files/ / USER lisk diff --git a/images/lisk/Makefile b/images/lisk/Makefile index bc47172..a178ec1 100644 --- a/images/lisk/Makefile +++ b/images/lisk/Makefile @@ -1,43 +1,33 @@ -.PHONY: all clean testnet -all: testnet mainnet - -tag = next +check-tag: + @: $(if $(tag),,$(error $$tag must be set)) + @echo Tag: $(tag) +.PHONY: clean clean: - rm -f *-lisk-Linux-x86_64.tar.gz* - -betanet-lisk-Linux-x86_64.tar.gz: - curl --fail https://downloads.lisk.io/lisk/beta/lisk-Linux-x86_64.tar.gz --output betanet-lisk-Linux-x86_64.tar.gz - curl --fail https://downloads.lisk.io/lisk/beta/lisk-Linux-x86_64.tar.gz.SHA256 --output betanet-lisk-Linux-x86_64.tar.gz.SHA256 - sed -i 's/ \(lisk-Linux-x86_64.tar.gz\)/ betanet-\1/' betanet-lisk-Linux-x86_64.tar.gz.SHA256 - sha256sum -c betanet-lisk-Linux-x86_64.tar.gz.SHA256 - -betanet: betanet-lisk-Linux-x86_64.tar.gz - docker build --build-arg network=betanet --tag lisk/betanet:$(tag) . - -development-lisk-Linux-x86_64.tar.gz: - curl --fail https://downloads.lisk.io/lisk/development/lisk-Linux-x86_64.tar.gz --output development-lisk-Linux-x86_64.tar.gz - curl --fail https://downloads.lisk.io/lisk/development/lisk-Linux-x86_64.tar.gz.SHA256 --output development-lisk-Linux-x86_64.tar.gz.SHA256 - sed -i 's/ \(lisk-Linux-x86_64.tar.gz\)/ development-\1/' development-lisk-Linux-x86_64.tar.gz.SHA256 - sha256sum -c development-lisk-Linux-x86_64.tar.gz.SHA256 - -development: development-lisk-Linux-x86_64.tar.gz - docker build --build-arg network=development --tag lisk/development:$(tag) . - -mainnet-lisk-Linux-x86_64.tar.gz: - curl --fail https://downloads.lisk.io/lisk/main/lisk-Linux-x86_64.tar.gz --output mainnet-lisk-Linux-x86_64.tar.gz - curl --fail https://downloads.lisk.io/lisk/main/lisk-Linux-x86_64.tar.gz.SHA256 --output mainnet-lisk-Linux-x86_64.tar.gz.SHA256 - sed -i 's/ \(lisk-Linux-x86_64.tar.gz\)/ mainnet-\1/' mainnet-lisk-Linux-x86_64.tar.gz.SHA256 - sha256sum -c mainnet-lisk-Linux-x86_64.tar.gz.SHA256 - -mainnet: mainnet-lisk-Linux-x86_64.tar.gz - docker build --build-arg network=mainnet --tag lisk/mainnet:$(tag) . - -testnet-lisk-Linux-x86_64.tar.gz: - curl --fail https://downloads.lisk.io/lisk/test/lisk-Linux-x86_64.tar.gz --output testnet-lisk-Linux-x86_64.tar.gz - curl --fail https://downloads.lisk.io/lisk/test/lisk-Linux-x86_64.tar.gz.SHA256 --output testnet-lisk-Linux-x86_64.tar.gz.SHA256 - sed -i 's/ \(lisk-Linux-x86_64.tar.gz\)/ testnet-\1/' testnet-lisk-Linux-x86_64.tar.gz.SHA256 - sha256sum -c testnet-lisk-Linux-x86_64.tar.gz.SHA256 - -testnet: testnet-lisk-Linux-x86_64.tar.gz - docker build --tag lisk/testnet:$(tag) . + rm -f lisk-*-Linux-x86_64.tar.gz* + +# different flavours will never have the same version number (tag) +lisk-%-Linux-x86_64.tar.gz: check-tag + wget --no-verbose --continue https://downloads.lisk.io/lisk/$(network)/$(tag)/lisk-$(tag)-Linux-x86_64.tar.gz + wget --no-verbose --continue https://downloads.lisk.io/lisk/$(network)/$(tag)/lisk-$(tag)-Linux-x86_64.tar.gz.SHA256 + sha256sum -c lisk-$(tag)-Linux-x86_64.tar.gz.SHA256 + +.PHONY: betanet +betanet: network=beta +betanet: check-tag lisk-$(tag)-Linux-x86_64.tar.gz + docker build --pull --build-arg tag=$(tag) --tag lisk/$@:$(tag) . + +.PHONY: development +development: network=development +development: check-tag lisk-$(tag)-Linux-x86_64.tar.gz + docker build --pull --build-arg tag=$(tag) --tag lisk/$@:$(tag) . + +.PHONY: testnet +testnet: network=test +testnet: check-tag lisk-$(tag)-Linux-x86_64.tar.gz + docker build --pull --build-arg tag=$(tag) --tag lisk/$@:$(tag) . + +.PHONY: mainnet +mainnet: network=main +mainnet: check-tag lisk-$(tag)-Linux-x86_64.tar.gz + docker build --pull --build-arg tag=$(tag) --tag lisk/$@:$(tag) .