forked from justins-engineering/vzw-nidd-serv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·51 lines (43 loc) · 1.15 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
45
46
47
48
49
50
51
#!/bin/sh
dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)
# Reset in case getopts has been used previously in the shell
OPTIND=1
while getopts "dprm" opt; do
case "$opt" in
d)
debug=1
;;
p)
prune=1
;;
r)
docker_run=1
;;
m)
if [ $debug ]; then
echo "Minsize image doesn't support debugging; ignoring debug flag"
echo
fi
minsize=1
;;
esac
done
shift $((OPTIND-1))
cd $dir
(cd $dir/modules/vzw-nidd-front-end && bundle exec middleman build --clean)
rm -rf ./assets
mv $dir/modules/vzw-nidd-front-end/build $dir/assets
if [ $minsize ]; then
docker build -t iots:dev --secret id=vzw_secrets.h,src=$dir/config/vzw_secrets.h -f $dir/Dockerfile.minsize $dir
elif [ $debug ]; then
docker build -t iots:dev --secret id=vzw_secrets.h,src=$dir/config/vzw_secrets.h --build-arg debug=true $dir
else
docker build -t iots:dev --secret id=vzw_secrets.h,src=$dir/config/vzw_secrets.h $dir
fi
if [ $prune ]; then
docker container prune -f && docker image prune -f && docker buildx prune -f
fi
if [ $docker_run ]; then
docker run --rm -p 80:80 --name iots_dev iots:dev
fi
cd -