-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·67 lines (65 loc) · 1.36 KB
/
run.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
#!/bin/bash
do_build() {
docker-compose build
}
do_start() {
docker-compose up -d
}
do_stop() {
docker-compose down
}
do_bash() {
docker-compose exec challenge bash
}
do_sh() {
docker-compose exec challenge sh
}
do_log() {
docker-compose logs -f
}
do_help() {
echo "CTFHub测试脚本"
echo "run.sh [test|build|start|stop|bash|sh|help]"
echo "+-------+----------------------------------+"
echo "| test | 依次执行stop->build->start->bash |"
echo "| build | 构建环境 |"
echo "| start | 启动环境 |"
echo "| stop | 停止环境 |"
echo "| bash | 执行bash进入Docker内部 |"
echo "| sh | 执行sh进入Docker内部 |"
echo "| log | 查看容器日志 |"
echo "| help | 打印本消息 |"
echo "+-------+----------------------------------+"
echo ""
echo "For Example: ./run.sh test"
}
case "$1" in
test)
do_stop
do_build
do_start
do_bash
;;
build)
do_build
;;
start)
do_start
;;
stop)
do_stop
;;
bash)
do_bash
;;
sh)
do_sh
;;
log)
do_log
;;
*)
do_help
;;
esac
exit 0