forked from biigle/gpus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·46 lines (38 loc) · 1.69 KB
/
build.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
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash
VERSION=$1
if [ -z "$VERSION" ]; then
VERSION=$(git describe --tags)
read -p "No build version specified, using latest git tag ${VERSION}. Press enter to continue."
fi
docker-compose build
read -p "Publish the images to GitHub? [y/N]" -n 1 -r
# Check if the current HEAD belongs to a version.
git describe --tags --exact-match &> /dev/null
if [ $? -eq 0 ]; then
if [[ $REPLY =~ ^[Yy]$ ]]; then
docker tag \
docker.pkg.github.com/biigle/gpus/gpus-app:latest \
docker.pkg.github.com/biigle/gpus/gpus-app:$VERSION
docker tag \
docker.pkg.github.com/biigle/gpus/gpus-worker:latest \
docker.pkg.github.com/biigle/gpus/gpus-worker:$VERSION
docker tag \
docker.pkg.github.com/biigle/gpus/gpus-web:latest \
docker.pkg.github.com/biigle/gpus/gpus-web:$VERSION
docker push docker.pkg.github.com/biigle/gpus/gpus-app:$VERSION
docker push docker.pkg.github.com/biigle/gpus/gpus-worker:$VERSION
docker push docker.pkg.github.com/biigle/gpus/gpus-web:$VERSION
docker rmi docker.pkg.github.com/biigle/gpus/gpus-app:$VERSION
docker rmi docker.pkg.github.com/biigle/gpus/gpus-worker:$VERSION
docker rmi docker.pkg.github.com/biigle/gpus/gpus-web:$VERSION
fi
fi
# Update the "latest" images if the current HEAD is on master.
if [ "$(git rev-parse --abbrev-ref HEAD)" == "master" ]; then
if [[ $REPLY =~ ^[Yy]$ ]]; then
docker push docker.pkg.github.com/biigle/gpus/gpus-app:latest
docker push docker.pkg.github.com/biigle/gpus/gpus-worker:latest
docker push docker.pkg.github.com/biigle/gpus/gpus-web:latest
fi
fi
docker image prune