2017-09-26 11:14:13 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set +e
|
|
|
|
|
2019-02-19 05:51:37 +01:00
|
|
|
if [ -z $2 ]; then
|
|
|
|
error "Please set the notary and migrate version"
|
2017-09-26 11:14:13 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-02-19 05:51:37 +01:00
|
|
|
echo "Building notary and golang-migrate from source, notary version: $1, golang-migrate version: $2"
|
2017-09-26 11:14:13 +02:00
|
|
|
set -e
|
|
|
|
|
|
|
|
# the temp folder to store binary file...
|
|
|
|
mkdir -p binary
|
2019-02-19 05:51:37 +01:00
|
|
|
rm -rf binary/* || true
|
2017-09-26 11:14:13 +02:00
|
|
|
|
|
|
|
cd `dirname $0`
|
2019-02-19 05:51:37 +01:00
|
|
|
docker build --build-arg NOTARY_VERSION=$1 --build-arg MIGRATE_VERSION=$2 -f ./binary.Dockerfile -t notary-binary .
|
2017-09-26 11:14:13 +02:00
|
|
|
|
2019-02-19 05:51:37 +01:00
|
|
|
echo 'copy the binary files to local...'
|
|
|
|
ID=$(docker create notary-binary)
|
|
|
|
docker cp $ID:/go/bin/notary-server binary/
|
|
|
|
docker cp $ID:/go/bin/notary-signer binary/
|
|
|
|
docker cp $ID:/go/bin/migrate binary/
|
|
|
|
docker cp $ID:/migrations binary/
|
2017-09-26 11:14:13 +02:00
|
|
|
|
2019-10-21 17:10:27 +02:00
|
|
|
sed -i 's/waiting for $DB_URL/waiting for database/g' binary/migrations/migrate.sh
|
|
|
|
|
2017-09-26 11:14:13 +02:00
|
|
|
docker rm -f $ID
|
2019-02-19 05:51:37 +01:00
|
|
|
docker rmi -f notary-binary
|
2017-09-26 11:14:13 +02:00
|
|
|
|