-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild
More file actions
executable file
·66 lines (56 loc) · 1.26 KB
/
build
File metadata and controls
executable file
·66 lines (56 loc) · 1.26 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
#!/bin/bash
#reset getopts
OPTIND=1
start_docker() {
open -a Docker || exit 1
i=0
while ! docker system info &>/dev/null; do
(( i++ == 0 )) && printf "Waiting for Docker daemon" %s || printf "."
sleep 1
done
(( i )) && printf '\n'
}
lein_build () {
lein deps
lein uberjar || exit 1
}
lein_install() {
brew install leiningen || exit 1 #note: this is not the preferred way to install lein
lein_build
}
#check lein installation
if command -v lein >/dev/null 2>&1; then
lein_build
else
if command -v brew >/dev/null 2>&1; then
lein_install
else
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
lein_install
fi
fi
#optional build args
TASK_DEFN=""
while getopts ":d:" opt; do
case $opt in
d)
TASK_DEFN="$OPTARG"
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
shift $((OPTIND-1))
[ "${1:-}" = "--" ] && shift
if [ "$TASK_DEFN" != "" ]; then
start_docker
docker build --build-arg TASK_DEFINITION=$TASK_DEFN --tag poolgp_server:latest .
docker tag poolgp_server:latest jackhay22/poolgp_server:latest
docker push jackhay22/poolgp_server:latest
fi