Add scripts for automating image builds
This commit is contained in:
parent
6a483b4a5c
commit
10ef601b4b
5 changed files with 64 additions and 4 deletions
4
Makefile
4
Makefile
|
@ -4,11 +4,11 @@ get_release:
|
||||||
|
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
build:
|
build:
|
||||||
docker build -t sayplastic/lbrynet .
|
docker build -t sayplastic/lbrynet:$(VERSION) .
|
||||||
|
|
||||||
.PHONY: publish
|
.PHONY: publish
|
||||||
publish:
|
publish:
|
||||||
docker push sayplastic/lbrynet
|
scripts/publish.sh
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf lbrynet lbrynet-linux.zip
|
rm -rf lbrynet lbrynet-linux.zip
|
||||||
|
|
17
README.md
17
README.md
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
## Image usage
|
## Image usage
|
||||||
|
|
||||||
|
Put this in your docker-compose file:
|
||||||
|
|
||||||
```
|
```
|
||||||
version: '3.2'
|
version: '3.2'
|
||||||
|
|
||||||
|
@ -21,9 +23,22 @@ services:
|
||||||
target: /storage
|
target: /storage
|
||||||
```
|
```
|
||||||
|
|
||||||
## Building
|
## Updating, building and publishing
|
||||||
|
|
||||||
|
#### Using the provided Makefile
|
||||||
|
|
||||||
|
This is the preferred method because it also checks if our newly built container can actually run.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
make get_release
|
||||||
|
VERSION=0.30.5 make build
|
||||||
|
VERSION=0.30.5 make publish
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Manually
|
||||||
|
|
||||||
|
```
|
||||||
|
make get_release
|
||||||
docker build -t sayplastic/lbrynet:0.30rc6 .
|
docker build -t sayplastic/lbrynet:0.30rc6 .
|
||||||
docker tag sayplastic/lbrynet:0.30rc6 sayplastic/lbrynet:latest
|
docker tag sayplastic/lbrynet:0.30rc6 sayplastic/lbrynet:latest
|
||||||
docker push sayplastic/lbrynet
|
docker push sayplastic/lbrynet
|
||||||
|
|
13
scripts/get_release.sh
Executable file
13
scripts/get_release.sh
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
URL=$(
|
||||||
|
curl -si https://api.github.com/repos/lbryio/lbry/releases/latest|
|
||||||
|
grep browser_download_url|
|
||||||
|
sed -E 's/.*"([^"]+)".*/\1/'|
|
||||||
|
grep linux
|
||||||
|
)
|
||||||
|
|
||||||
|
echo "Getting the latest release from $URL..."
|
||||||
|
curl -sOL $URL
|
||||||
|
unzip lbrynet-linux.zip
|
||||||
|
rm lbrynet-linux.zip
|
28
scripts/publish.sh
Executable file
28
scripts/publish.sh
Executable file
|
@ -0,0 +1,28 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set +x
|
||||||
|
set -e
|
||||||
|
|
||||||
|
WAIT=5
|
||||||
|
BASE_IMAGE_NAME=sayplastic/lbrynet
|
||||||
|
|
||||||
|
if [ -z ${VERSION+x} ]; then
|
||||||
|
echo "Please provide sayplastic/lbrynet 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 sayplastic/lbrynet:$VERSION
|
6
start.sh
6
start.sh
|
@ -7,4 +7,8 @@ if [ ! -d "$LBRY_DOWNLOAD_DIRECTORY" ]; then
|
||||||
mkdir $LBRY_DOWNLOAD_DIRECTORY
|
mkdir $LBRY_DOWNLOAD_DIRECTORY
|
||||||
fi
|
fi
|
||||||
|
|
||||||
./lbrynet start
|
if [ -z ${LBRY_DOCKER_CONFIG+x} ]; then
|
||||||
|
./lbrynet start --config=/daemon/daemon_settings.yml
|
||||||
|
else
|
||||||
|
./lbrynet start --config=$LBRY_DOCKER_CONFIG
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in a new issue