-
Notifications
You must be signed in to change notification settings - Fork 8
/
update.sh
executable file
·33 lines (30 loc) · 1.16 KB
/
update.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
command -v docker >/dev/null 2>&1 || { echo >&2 "'docker' is required but not installed. See https://github.com/shardeum/validator-dashboard?tab=readme-ov-file#how-to-install-and-run-a-shardeum-validator-node for details."; exit 1; }
if command -v docker-compose &>/dev/null; then
echo "docker-compose is installed on this machine"
elif docker --help | grep -q "compose"; then
echo "docker compose subcommand is installed on this machine"
else
echo "docker-compose or docker compose is not installed on this machine"
exit 1
fi
docker-safe() {
if ! command -v docker &>/dev/null; then
echo "docker is not installed on this machine"
exit 1
fi
if ! docker $@; then
echo "Trying again with sudo..."
sudo docker $@
fi
}
echo "Updating validator image and rebuilding docker..."
./docker-down.sh
echo "Clearing validator images..."
./cleanup.sh
echo "Updating local repo..."
git pull origin main
echo "Rebuilding local validator image..."
docker-safe build --no-cache -t local-dashboard -f Dockerfile --build-arg RUNDASHBOARD=y .
./docker-up.sh
echo "Starting image. This could take a while..."
(docker-safe logs -f shardeum-dashboard &) | grep -q 'done'