-
Notifications
You must be signed in to change notification settings - Fork 27
/
update
executable file
·44 lines (35 loc) · 980 Bytes
/
update
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 -e
if [[ "${CI}" ]]; then
set -x
fi
function usage() {
echo -n \
"Usage: $(basename "$0") [--no-cache] [--restart]
Builds the docker containers for this project.
--no-cache: Rebuild all containers from scratch.
--restart: Restart servers and remove orphan containers
"
}
# Parse args
NO_CACHE="";
while [[ "$#" > 0 ]]; do case $1 in
--no-cache) NO_CACHE="--no-cache"; shift;;
--restart) RESTART_SERVERS=1; shift;;
--help) usage; exit 0; shift;;
*) usage "Unknown parameter passed: $1"; shift; shift;;
esac; done
if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
if [ "${RESTART_SERVERS}" ]; then
echo "==Bringing down servers.."
docker compose \
-f docker-compose.yml \
-f docker-compose.dev.yml \
down --remove-orphans
fi
echo "==Building images..."
docker compose \
-f docker-compose.yml \
-f docker-compose.dev.yml \
build ${NO_CACHE}
fi