-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·41 lines (37 loc) · 816 Bytes
/
build.sh
File metadata and controls
executable file
·41 lines (37 loc) · 816 Bytes
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
print_help()
{
echo "***************** Usage ******************"
echo "-e build docker environment"
echo "-s start shell in image"
echo "-h this help text"
}
if [ -z "$*" ]; then
print_help;
exit 0;
fi
case $1 in
-e)
docker build -t cpp-build-env -f Dockerfile .
;;
-s)
DOCKER_ARGS="--privileged \
--rm=true \
-it \
-u user \
-v $HOME:/home/user \
-v empty:/home/user/.local/bin \
-v $(pwd):/tmp/$(basename "$(pwd)") \
-w /tmp/$(basename "$(pwd)")"
# Just run the command if we are inside a docker container
if [ -f /.dockerenv ]; then
$*
else
DOCKER_COMMAND="docker run $DOCKER_ARGS --network host cpp-build-env"
$DOCKER_COMMAND
fi
;;
-h)
print_help
;;
esac