-
Notifications
You must be signed in to change notification settings - Fork 148
/
build.sh
executable file
·44 lines (38 loc) · 1.04 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
#!/bin/bash
set -euxo pipefail
#
# Build the image
#
# Normally run by the Makefile:
#
# $ make VERSION=$VERSION build
#
# It expects the following variables to be set:
#
# * VERSION (9.0, 10.0, 11.0, ...)
# * BUILD_TAG (tag of the 'latest' image built)
# * DOCKERFILE (name of the file used for the Docker build)
#
if [ -z "$VERSION" ]; then
echo "VERSION environment variable is missing"
exit 1
fi
TMP=$(mktemp -d)
echo "Working in $TMP"
on_exit() {
echo "Cleaning up temporary directory..."
rm -rf $TMP
rm -f /tmp/odoo.tar.gz
}
trap on_exit EXIT
cp -r ${VERSION}/. ${TMP}/
cp -r bin/ ${TMP}
cp -rT common/ ${TMP}
cp ${TMP}/Dockerfile-onbuild ${TMP}/Dockerfile-batteries-onbuild
sed -i "1i FROM ${BUILD_TAG}" ${TMP}/Dockerfile-onbuild
sed -i "1i FROM ${BUILD_TAG}" ${TMP}/Dockerfile-batteries
sed -i "1i FROM ${BUILD_TAG}-batteries" ${TMP}/Dockerfile-batteries-onbuild
cp -r install/ ${TMP}
cp -r start-entrypoint.d/ ${TMP}
cp -r before-migrate-entrypoint.d/ ${TMP}
docker build --no-cache -f ${TMP}/Dockerfile -t ${BUILD_TAG} ${TMP}