Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Build from versioned tarballs #86

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@ 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
'''
}
}
}
}
stage('smoke tests') {
steps {
ansiColor('xterm') {
dir('examples/testnet/') {
dir('examples/development/') {
sh 'make'
retry(3) {
sleep 10
Expand All @@ -31,7 +35,7 @@ pipeline {
post {
always {
ansiColor('xterm') {
dir('examples/testnet/') {
dir('examples/development/') {
sh 'make mrproper'
}
}
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <mainnet|testnet>`
`make tag=<version> -C images/lisk <mainnet|testnet|betanet|development>`

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

Expand Down
2 changes: 1 addition & 1 deletion examples/betanet/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "2"
services:

lisk:
image: lisk/betanet:next
image: lisk/betanet:latest
volumes:
- lisk-logs:/home/lisk/lisk/logs/
ports:
Expand Down
2 changes: 1 addition & 1 deletion examples/development/.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
LISK_VERSION=next
LISK_VERSION=latest
4 changes: 0 additions & 4 deletions images/Makefile

This file was deleted.

8 changes: 4 additions & 4 deletions images/lisk/Dockerfile
Original file line number Diff line number Diff line change
@@ -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/*
Expand All @@ -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
Expand Down
72 changes: 31 additions & 41 deletions images/lisk/Makefile
Original file line number Diff line number Diff line change
@@ -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) .