2019-01-29 13:01:05 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-07-08 10:22:48 +02:00
|
|
|
set -e
|
|
|
|
|
2019-10-26 07:11:37 +02:00
|
|
|
BASE_IMAGE_NAME=lbry/lbrynet-tv
|
|
|
|
|
2019-04-29 11:01:25 +02:00
|
|
|
if [[ ${1} == "rc" ]]; then
|
|
|
|
API_URL="https://api.github.com/repos/lbryio/lbry/releases"
|
2019-06-19 15:50:54 +02:00
|
|
|
RC_SUFFIX="-rc"
|
2020-02-29 20:25:22 +01:00
|
|
|
elif [ ${1} != "" ]; then
|
|
|
|
API_URL="https://api.github.com/repos/lbryio/lbry/releases/tags/${1}"
|
|
|
|
RC_SUFFIX=""
|
2019-04-29 11:01:25 +02:00
|
|
|
else
|
|
|
|
API_URL="https://api.github.com/repos/lbryio/lbry/releases/latest"
|
2019-07-08 10:22:48 +02:00
|
|
|
RC_SUFFIX=""
|
2019-04-29 11:01:25 +02:00
|
|
|
fi
|
|
|
|
|
2020-02-29 20:25:22 +01:00
|
|
|
echo "URL: ${API_URL}"
|
2019-07-08 10:22:48 +02:00
|
|
|
|
2019-01-29 13:01:05 +01:00
|
|
|
URL=$(
|
2019-07-08 10:22:48 +02:00
|
|
|
curl -siL ${API_URL}|
|
2019-01-29 13:01:05 +01:00
|
|
|
grep browser_download_url|
|
2019-04-29 11:01:25 +02:00
|
|
|
grep linux|
|
|
|
|
head -n 1|
|
|
|
|
sed -E 's/.*"([^"]+)".*/\1/'
|
2019-01-29 13:01:05 +01:00
|
|
|
)
|
|
|
|
|
2019-04-29 11:01:25 +02:00
|
|
|
VERSION=$(echo $URL|sed -e 's/.*download\/v\([^"]*\)\/.*/\1/')
|
|
|
|
|
|
|
|
echo "Getting the latest version ${VERSION} from ${URL}..."
|
2019-03-25 18:04:31 +01:00
|
|
|
curl -OL $URL
|
2019-01-29 13:01:05 +01:00
|
|
|
unzip lbrynet-linux.zip
|
|
|
|
rm lbrynet-linux.zip
|
2019-04-29 11:01:25 +02:00
|
|
|
|
2019-10-26 07:11:37 +02:00
|
|
|
docker build -t ${BASE_IMAGE_NAME}:${VERSION} -t ${BASE_IMAGE_NAME}:latest${RC_SUFFIX} .
|