-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgo.sh
executable file
·53 lines (47 loc) · 1017 Bytes
/
go.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
#!/usr/bin/env bash
tag=fg_$USER:latest
name=fg_$USER
target=
data=
registry=
xauth=
entrypoint=
ipc=
net=host
user=
cwd=1
interactive=1
script=
port=
constraint=
runtime=
[ -f env.sh ] && . env.sh
build() {
docker build \
${target:+--target $target} \
-t $tag .
}
run() {
if [ -n "$xauth" ]; then
rm -f $xauth
xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $xauth nmerge -
fi
docker run --rm \
${interactive:+-it} \
${script:+-a stdin -a stdout -a stderr --sig-proxy=true} \
${ipc:+--ipc=$ipc} \
${net:+--net=$net} \
${user:+-u $(id -u):$(id -g)} \
${cwd:+-v $PWD:$PWD -w $PWD} \
${port:+-p $port:$port} \
${data:+-v $data:$data} \
${runtime:+--runtime $runtime} \
${xauth:+-e DISPLAY -v /etc/group:/etc/group:ro -v /etc/passwd:/etc/passwd:ro -v /etc/shadow:/etc/shadow:ro -v /etc/sudoers.d:/etc/sudoers.d:ro -v $xauth:$xauth -e XAUTHORITY=$xauth} \
${entrypoint:+--entrypoint $entrypoint} \
$tag \
"$@"
}
inspect() {
entrypoint='/bin/bash -i' run "$@"
}
"$@"