forked from nsacyber/WALKOFF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
walkoff.sh
executable file
·41 lines (35 loc) · 1.09 KB
/
walkoff.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
#!/bin/bash
BUILDARG="^-[a-zA-Z]*b|--build"
if [[ $1 == "up" ]]; then
for var in "$@"
do
if [[ $var =~ $BUILDARG ]]; then
echo "Preparing WALKOFF Bootloader..."
docker build -t walkoff_bootloader -f bootloader/Dockerfile .
break
fi
done
fi
echo "Starting WALKOFF Bootloader..."
if [ ! "$(docker network ls | grep -w "walkoff_network")" ]; then
printf "Creating walkoff_network network: "
docker network create --attachable=True --driver=overlay walkoff_network
fi
docker run --rm -it --network walkoff_network --name walkoff_bootloader \
--mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock \
--mount type=bind,source=$(pwd),target=$(pwd) \
--mount type=bind,source=$(pwd)/data/config.yml,target=/common_env.yml \
-e DOCKER_HOST=unix:///var/run/docker.sock \
-w $(pwd) \
walkoff_bootloader "$@"
CLEANARG="^-[a-zA-Z]*c|--clean"
if [[ $1 == "down" ]]; then
for var in "$@"
do
if [[ $var =~ $CLEANARG ]]; then
printf "Removing walkoff_network network: "
docker network rm walkoff_network
break
fi
done
fi