-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
docker.sh
95 lines (87 loc) · 1.76 KB
/
docker.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#1/bin/bash
stack_name="mika"
compose_file="docker-compose.yml"
run_mysql () {
docker-compose -f ${compose_file} -p ${stack_name} run --rm mariadb mysql -uunit3d -punit3d -D unit3d
}
run_redis() {
docker-compose -f ${compose_file} -p ${stack_name} run --rm redis redis-cli
}
run_up() {
docker-compose -f ${compose_file} -p ${stack_name} up --remove-orphans -d
}
run_usage() {
echo "Usage: $0 {artisan|build|clean|cleanall|config|down|exec|install|logs|prune|redis|run|sql}"
exit 1
}
run_docker_build() {
docker build -t leighmacdonald/mika:latest .
}
run_build_release() {
docker build -t "leighmacdonald/mika:$(git describe --abbrev=0)" .
}
run_docker_publish_latest() {
docker push leighmacdonald/mika:latest
}
run_docker_publish_release() {
docker push "leighmacdonald/mika:$(git describe --abbrev=0)"
}
case "$1" in
build)
run_docker_build
;;
build_release)
run_build_release
;;
docker_publish_latest)
run_docker_publish_latest
;;
docker_publish_release)
run_docker_publish_release
;;
clean)
run_clean
;;
cleanall)
run_clean
run_clean_config
;;
config)
run_config "$2" "$3"
;;
down)
shift
docker-compose -f ${compose_file} -p ${stack_name} down "$@"
;;
exec)
shift
docker-compose -f ${compose_file} -p ${stack_name} exec "$@"
;;
install)
run_install
;;
logs)
shift
docker-compose -f ${compose_file} -p ${stack_name} logs "$@"
;;
prune)
run_prune
;;
redis)
run_redis
;;
run)
docker-compose run --rm mika
;;
sql)
run_sql
;;
up)
shift
docker-compose -f ${compose_file} -p ${stack_name} up -d "$@"
docker-compose -f ${compose_file} -p ${stack_name} logs -f "$@"
;;
*)
run_usage
;;
esac