Newer
Older
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
# TODO add a way to bypass the value, maybe with a key in the setup.cfg file
repository=dockerhub.xcg.io
# TODO add a way to bypass the value, maybe with a key in the setup.cfg file
project_home=$(dirname $0)/..
image=$(basename $(readlink -f $project_home))
pushd $project_home
# Ensureconf
hg cfensureconf || { echo 'hg cfensureconf failed' ; popd ; exit 1; }
popd
# Grab latest base image
ODOO_TYPE=$(cat $project_home/odoo_type)
if [ "$ODOO_TYPE" = "odoo8" ];
then
docker pull xcgd/odoo:8.0 || { echo 'Pull failed' ; exit 1; }
else
docker pull xcgd/odoo:7.0 || { echo 'Pull failed' ; exit 1; }
fi
docker build -t $repository/$image $project_home || { echo 'Build failed' ; exit 1; }
# tip is latest in docker
for tag in $(cd $project_home && hg id -t);
do
if [[ ! -z "$tag" && "tip" != "$tag" ]]
then
echo "Docker tag with hg tag: $tag"
docker tag -f $repository/$image $repository/$image:$tag || { echo 'Tag failed' ; exit 1; }
fi
done
for bookmark in $(cd $project_home && hg id -B);
do
echo "Docker tag with hg bookmark: $bookmark"
docker tag -f $repository/$image $repository/$image:$bookmark || { echo 'Tag failed' ; exit 1; }
done
echo "Pushing docker image"
docker push $repository/$image || { echo 'Push failed' ; exit 1; }