-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathdockerbuild.sh
More file actions
executable file
·69 lines (67 loc) · 2.3 KB
/
dockerbuild.sh
File metadata and controls
executable file
·69 lines (67 loc) · 2.3 KB
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
62
63
64
65
66
67
68
69
#!/bin/bash
set -e
USAGE="Usage: $0 [centos-7|centos-8|ubuntu-1804] <make args...>"
CACHE_DIR=/tmp/vmango-package-build-cache
mkdir -p $CACHE_DIR
case "$1" in
"centos-8")
DOCKER_IMAGE=vmango:build_centos8
YUM_CONFIG=`pwd`/dockerbuild/centos8.yum.conf
if [[ "Y$(docker images -q $DOCKER_IMAGE)" == "Y" || "Y${FORCE_REBUILD}" != "Y" ]]; then
docker build -t $DOCKER_IMAGE -f dockerbuild/centos8.dockerfile .
fi
shift
exec docker run --rm -it \
-v `pwd`:/source \
-v $CACHE_DIR:/cache \
-v $YUM_CONFIG:/etc/yum.conf \
-w /source \
$DOCKER_IMAGE $@
;;
"centos-7")
DOCKER_IMAGE=vmango:build_centos7
YUM_CONFIG=`pwd`/dockerbuild/centos7.yum.conf
if [[ "Y$(docker images -q $DOCKER_IMAGE)" == "Y" || "Y${FORCE_REBUILD}" != "Y" ]]; then
docker build -t $DOCKER_IMAGE -f dockerbuild/centos7.dockerfile .
fi
shift
exec docker run --rm -it \
-v `pwd`:/source \
-v $CACHE_DIR:/cache \
-v $YUM_CONFIG:/etc/yum.conf \
-w /source \
$DOCKER_IMAGE $@
;;
"ubuntu-1804")
DOCKER_IMAGE=vmango:build_ubuntu1804
YUM_CONFIG=`pwd`/dockerbuild/centos7.yum.conf
if [[ "Y$(docker images -q $DOCKER_IMAGE)" == "Y" || "Y${FORCE_REBUILD}" != "Y" ]]; then
docker build -t $DOCKER_IMAGE -f dockerbuild/ubuntu1804.dockerfile .
fi
mkdir -p $CACHE_DIR/apt
shift
exec docker run --rm -it \
-v `pwd`:/source \
-v $HOME/.gnupg/:/root/.gnupg \
-v $CACHE_DIR/apt_ubuntu1804:/var/cache/apt \
-w /source \
$DOCKER_IMAGE $@
;;
"debian-10")
DOCKER_IMAGE=vmango:build_debian10
YUM_CONFIG=`pwd`/dockerbuild/centos7.yum.conf
if [[ "Y$(docker images -q $DOCKER_IMAGE)" == "Y" || "Y${FORCE_REBUILD}" != "Y" ]]; then
docker build -t $DOCKER_IMAGE -f dockerbuild/debian10.dockerfile .
fi
mkdir -p $CACHE_DIR/apt
shift
exec docker run --rm -it \
-v `pwd`:/source \
-v $CACHE_DIR/apt_debian_10:/var/cache/apt \
-w /source \
$DOCKER_IMAGE $@
;;
*)
echo $USAGE
exit 1
esac