-
Notifications
You must be signed in to change notification settings - Fork 4
/
auto-dock-tag.sh
executable file
·64 lines (48 loc) · 1.25 KB
/
auto-dock-tag.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
context=.
container="castle-latest"
version="latest"
image="realworldio/castlecms:$version"
cmd="docker build -t $image $context"
deleteTags="No"
while getopts "hd" arg; do
case $arg in
h)
echo "usage"
;;
d)
deleteTags="Yes"
;;
\?)
echo "WRONG" >&2
;;
esac
done
echo "Cleaning up tags"
git tag -d $(git tag -l)
for file in $(find ./*/ -type f -name 'Dockerfile'); do
context="$(dirname $file)"
based_os="$(dirname $context)"
version="$(basename $based_os)"
image="realworldio/castlecms:$version"
echo "---> Switch to tagit"
git checkout -b tagit
echo "---> Clone files to tagit"
cp $context/* ./release/
git status
git add release
git status
echo "---> Commit changes for castlecms:$version"
git commit -m "Build castlecms:$version image"
echo "---> Build tag for castlecms:$version"
git tag -a v$version -m "Release realworldio/castlecms:$version image"
git checkout master
git branch -D tagit
echo "---> Clean up"
rm -f release/Dockerfile
rm -f release/docker-entrypoint.sh
rm -f release/docker-initialize.py
if [ "$deleteTags" == "Yes" ]; then
git push --delete origin v$version
fi
done