Streamline build procedure
This commit is contained in:
parent
162a5fcd6d
commit
8c1e3dcc09
7 changed files with 60 additions and 86 deletions
19
Makefile
19
Makefile
|
@ -1,18 +1,9 @@
|
|||
all:
|
||||
make clean
|
||||
make latest_image
|
||||
make publish
|
||||
make clean
|
||||
image:
|
||||
scripts/build.sh ${VERSION}
|
||||
|
||||
latest_image:
|
||||
scripts/get_release.sh
|
||||
|
||||
latest_rc_image:
|
||||
scripts/get_release.sh rc
|
||||
|
||||
.PHONY: publish
|
||||
publish:
|
||||
scripts/publish.sh
|
||||
.PHONY: push
|
||||
push:
|
||||
scripts/push.sh ${VERSION}
|
||||
|
||||
clean:
|
||||
rm -rf lbrynet lbrynet-linux.zip
|
||||
|
|
14
README.md
14
README.md
|
@ -32,17 +32,15 @@ You need to have the docker toolset installed on your system, as well as the abi
|
|||
This is the preferred method because it also checks if our newly built container can actually run.
|
||||
|
||||
```
|
||||
make latest_image
|
||||
# or
|
||||
make latest_rc_image
|
||||
make publish VERSION=0.36.0
|
||||
export VERSION=0.101.1
|
||||
make image
|
||||
make publish
|
||||
```
|
||||
|
||||
#### Manually
|
||||
|
||||
```
|
||||
make get_release
|
||||
docker build -t lbry/lbrynet-tv:0.36.0 .
|
||||
docker tag lbry/lbrynet-tv:0.36.0 lbry/lbrynet-tv:latest
|
||||
docker push lbry/lbrynet-tv
|
||||
make image
|
||||
docker build -t lbry/lbrynet-tv:0.101.1
|
||||
docker push lbry/lbrynet-tv:0.101.1
|
||||
```
|
||||
|
|
|
@ -46,4 +46,5 @@ if [ ! -z ${SDK_LBRYUM_SERVERS+x} ]; then
|
|||
SDK_ARGS="${SDK_ARGS} --lbryum-servers=${SDK_LBRYUM_SERVERS}"
|
||||
fi
|
||||
|
||||
rm -rf /storage/lbrynet/lbrynet.sqlite*
|
||||
./lbrynet start --config=$CONFIG $SDK_ARGS
|
||||
|
|
34
scripts/build.sh
Executable file
34
scripts/build.sh
Executable file
|
@ -0,0 +1,34 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
BASE_IMAGE_NAME=lbry/lbrynet-tv
|
||||
WAIT=5
|
||||
|
||||
if [ -z ${1} ]; then
|
||||
echo "Please provide lbrynet version as an argument."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION=$1
|
||||
RELEASE_URL="https://github.com/lbryio/lbry-sdk/releases/download/v$VERSION/lbrynet-linux.zip"
|
||||
|
||||
echo "Getting the version ${VERSION} from ${RELEASE_URL}..."
|
||||
curl -OL $RELEASE_URL
|
||||
unzip lbrynet-linux.zip
|
||||
rm lbrynet-linux.zip
|
||||
|
||||
docker build -t ${BASE_IMAGE_NAME}:${VERSION} .
|
||||
|
||||
echo "Launching container for ${BASE_IMAGE_NAME}:${VERSION} and giving it ${WAIT}s to launch..."
|
||||
|
||||
ID=$(docker run --detach --rm $BASE_IMAGE_NAME:$VERSION)
|
||||
sleep $WAIT
|
||||
|
||||
if [[ -z "${ID+x}" || ! $(docker top "$ID") ]]; then
|
||||
echo "Container crashed unexpectedly, aborting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Container launched successfully, stopping it"
|
||||
docker kill $ID
|
|
@ -1,35 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
BASE_IMAGE_NAME=lbry/lbrynet-tv
|
||||
|
||||
if [[ ${1} == "rc" ]]; then
|
||||
API_URL="https://api.github.com/repos/lbryio/lbry/releases"
|
||||
RC_SUFFIX="-rc"
|
||||
elif [ ${1} != "" ]; then
|
||||
API_URL="https://api.github.com/repos/lbryio/lbry/releases/tags/${1}"
|
||||
RC_SUFFIX=""
|
||||
else
|
||||
API_URL="https://api.github.com/repos/lbryio/lbry/releases/latest"
|
||||
RC_SUFFIX=""
|
||||
fi
|
||||
|
||||
echo "URL: ${API_URL}"
|
||||
|
||||
URL=$(
|
||||
curl -siL ${API_URL}|
|
||||
grep browser_download_url|
|
||||
grep linux|
|
||||
head -n 1|
|
||||
sed -E 's/.*"([^"]+)".*/\1/'
|
||||
)
|
||||
|
||||
VERSION=$(echo $URL|sed -e 's/.*download\/v\([^"]*\)\/.*/\1/')
|
||||
|
||||
echo "Getting the latest version ${VERSION} from ${URL}..."
|
||||
curl -OL $URL
|
||||
unzip lbrynet-linux.zip
|
||||
rm lbrynet-linux.zip
|
||||
|
||||
docker build -t ${BASE_IMAGE_NAME}:${VERSION} -t ${BASE_IMAGE_NAME}:latest${RC_SUFFIX} .
|
|
@ -1,29 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
WAIT=5
|
||||
BASE_IMAGE_NAME=lbry/lbrynet-tv
|
||||
|
||||
if [ -z ${VERSION+x} ]; then
|
||||
echo "Please provide ${BASE_IMAGE_NAME} version as \$VERSION variable."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Launching daemon container for ${BASE_IMAGE_NAME}:${VERSION} and giving it ${WAIT} secs..."
|
||||
|
||||
ID=$(docker run --detach --rm $BASE_IMAGE_NAME:$VERSION)
|
||||
sleep $WAIT
|
||||
|
||||
if [[ -z "${ID+x}" || ! $(docker top "$ID") ]]; then
|
||||
echo "Container crashed unexpectedly, aborting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Container launched successfully, stopping it"
|
||||
docker kill $ID
|
||||
|
||||
echo "Pushing to Docker Hub..."
|
||||
docker push ${BASE_IMAGE_NAME}:${VERSION}
|
||||
docker push ${BASE_IMAGE_NAME}:latest
|
14
scripts/push.sh
Executable file
14
scripts/push.sh
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
BASE_IMAGE_NAME=lbry/lbrynet-tv
|
||||
|
||||
if [ -z ${1} ]; then
|
||||
echo "Please provide ${BASE_IMAGE_NAME} version as an argument."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION=$1
|
||||
echo "Pushing to Docker Hub..."
|
||||
docker push ${BASE_IMAGE_NAME}:${VERSION}
|
Loading…
Reference in a new issue