forked from dodona-edu/docker-images
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy_workers.sh
executable file
·39 lines (33 loc) · 989 Bytes
/
deploy_workers.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
34
35
36
37
#!/bin/sh
workers="
salmoneu.ugent.be
sisyphus.ugent.be
tantalus.ugent.be
tityos.ugent.be
ixion.ugent.be
naos.ugent.be
"
images=""
for arg in $@; do
arg="${arg#dodona/}" # strip possible leading 'dodona/'
arg="${arg%.dockerfile}" # strip possible trailing '.dockerfile'
if [ "$arg" != "${arg#dodona-}" ]; then # image name starts with "dodona-"
images="$images dodona/$arg:latest"
fi
done
if [ -z "$images" ]; then
echo "usage: $0 IMAGE..."
echo "examples:"
echo " $0 dodona-python # only deploy dodona-python image"
echo " $0 * # deploy all images which have a dockerfile in this directory"
exit 1
fi
for worker in $workers; do
for img in $images; do
echo "=== Pulling $img on $worker ==="
ssh -p 4840 dodona@"$worker" "docker pull $img"
echo
done
echo "=== Pruning old images on $worker ==="
ssh -p 4840 dodona@"$worker" "docker system prune -f"
done