-
Notifications
You must be signed in to change notification settings - Fork 401
/
connect.sh
executable file
·49 lines (44 loc) · 1.36 KB
/
connect.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
#!/bin/bash
# Creates a new container from the build environment image
# and drops you into an interactive prompt.
# From there you can run a build via the build script directly
# by going to /out and running /src/build.sh.
PrintUsage()
{
cat <<EOF
This tool will launch a build container and drop you into a bash prompt.
connect.sh [-h]
-h, --help: Show this help screen and exit
EOF
}
while (( "$#" )); do
if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
PrintUsage
exit -1
else
echo "Unexpected option $1"
PrintUsage
exit -2
fi
done
# change directory to the one containing this script and
# record this directories full path.
CDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DOCKERIMAGE_VERSION=`cat "$CDIR"/tools/build/DOCKERIMAGE_VERSION`
OUT_DIR=$CDIR/out
echo "Running container version $DOCKERIMAGE_VERSION"
# net=host for connection on corpnet
# cap-add SYS_PTRACE for strace to work.
# Note that this has a relative path. It assumes that
# the script is two folders from the root directory.
# the CDIR above will always make this script execute
# from the directory the script lives in.
docker run \
--net=host \
--cap-add NET_ADMIN \
-ti \
-v "$OUT_DIR":/out \
-v "$CDIR"/deps:/deps \
-v "$CDIR"/src:/src \
microsoft/service-fabric-build-ubuntu:$DOCKERIMAGE_VERSION \
bash -i