-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild
More file actions
executable file
·69 lines (58 loc) · 1.57 KB
/
build
File metadata and controls
executable file
·69 lines (58 loc) · 1.57 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
#
# Build a LOCAL docker image.
# After this, your probably want to use ./tag and ./push.
#
set -e
. ./common.sh
if [ "x$1" = "x" ]; then
echo "Syntax: $0 [-f] image ..."
echo ""
echo " -f force re-build by not using cache"
echo ""
exit 1
fi
build_opts=""
force=0
if [ "x$1" = "x-f" ]; then
force=1
build_opts+=" --no-cache=true"
shift
fi
sudo=$(get_docker_sudo_command)
check_is_subdirs $*
git pull
for this in $*; do
ver='latest'
local_base=$(get_local_image_base)
image=$(echo $this | sed -e 's!/*$!!') # remove trailing slashes
dir=$(echo ${image} | awk -F : '{print $1}')
test -f ${dir}/metadata.sh && . ${dir}/metadata.sh
if [ -d "${dir}/${ver}" ]; then
dir="${dir}/${ver}"
test -f ${dir}/metadata.sh && . ${dir}/metadata.sh
fi
echo ""
echo "###############################################"
echo "Building ${local_base}/${image}:${ver}"
echo "###############################################"
echo ""
if [ $force -eq 1 ]; then
${sudo} docker rmi "${local_base}/${image}:${ver}" || true
fi
if [ -x $dir/build.sh ]; then
echo ""
echo "Using custom build script: $dir/build.sh"
echo ""
cd $dir
./build.sh
else
${sudo} docker build $build_opts --force-rm=true -t="${local_base}/${image}:${ver}" "${dir}"
fi
echo ""
echo "###############################################"
echo "FINISHED building ${local_base}/${image}:${ver}"
echo "###############################################"
echo ""
docker images ${local_base}/${image}:${ver}
done