-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker_cmd.sh
executable file
·61 lines (50 loc) · 1.63 KB
/
docker_cmd.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
#!/bin/bash
function print_usage() {
RED='\033[0;31m'
BLUE='\033[0;34m'
BOLD='\033[1m'
NONE='\033[0m'
echo -e "\n${RED}Usage${NONE}:
.${BOLD}/docker_cmd.sh${NONE} [OPTION]"
echo -e "\n${RED}OPTIONS${NONE}:
${BLUE}build${NONE}: build penglai-demo image
${BLUE}run-qemu${NONE}: run penglai-demo image in (modified) qemu
"
}
# no arguments
if [ $# == 0 ]; then
echo "Default: building penglai demo image"
docker run -v $(pwd):/home/penglai/penglai-enclave -w /home/penglai/penglai-enclave --rm -it ddnirvana/penglai-enclave:v0.1 bash scripts/build_opensbi.sh
exit 0
fi
if [[ $1 == *"help"* ]]; then
print_usage
exit 0
fi
# build penglai
if [[ $1 == *"build"* ]]; then
echo "Build: building penglai demo image"
docker run -v $(pwd):/home/penglai/penglai-enclave -w /home/penglai/penglai-enclave --rm -it ddnirvana/penglai-enclave:v0.1 bash scripts/build_opensbi.sh
exit 0
fi
# build penglai
if [[ $1 == *"qemu"* ]]; then
echo "Run: run penglai demo image in Qemu (built with openEuler)"
./run_openeuler.sh
exit 0
fi
# run docker
if [[ $1 == *"docker"* ]]; then
echo "Run: run docker"
#sudo docker run --privileged --cap-add=ALL -v $(pwd):/home/penglai/penglai-enclave -w /home/penglai/penglai-enclave --rm -it ddnirvana/penglai-enclave:v0.1
docker run -v $(pwd):/home/penglai/penglai-enclave -w /home/penglai/penglai-enclave --network=host --rm -it ddnirvana/penglai-enclave:v0.5 bash
exit 0
fi
# make clean
if [[ $1 == *"clean"* ]]; then
echo "Clean: make clean"
docker run -v $(pwd):/home/penglai/penglai-enclave -w /home/penglai/penglai-enclave --rm -it ddnirvana/penglai-enclave:v0.1 make clean
exit 0
fi
print_usage
exit 1