-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·52 lines (49 loc) · 1.9 KB
/
run.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
#!/usr/bin/env bash
mode="$1"
image="${2:-maurelio1234/emacs-docker}"
volumes=" -v /home/$USER/.ssh:/home/$USER/.ssh \
-v /mnt/data/bitbucket:/home/$USER/bitbucket \
-v /mnt/data/github:/home/$USER/github \
-v /mnt/data/Downloads:/home/$USER/Downloads \
-v /mnt/data/github/emacs-docker/.emacs.d/init.el:/home/$USER/.emacs.d/init.el \
-v /mnt/data/github/emacs-docker/.config:/home/$USER/.config \
-v /mnt/data/github/emacs-docker/.emacs.d/init-test.el:/home/$USER/.emacs.d/init-test.el \
-v /mnt/data/github/emacs-docker/.emacs.d/bootstrap.el:/home/$USER/.emacs.d/bootstrap.el \
-v /mnt/data/emacs/eln-cache:/home/$USER/.emacs.d/eln-cache \
-v /mnt/data/vim/plugged:/home/$USER/.vim/plugged \
-v /mnt/data/exercism:/home/$USER/exercism \
-v /etc/localtime:/etc/localtime \
-v /etc/timezone:/etc/timezone \
-v /var/run/docker.sock:/var/run/docker.sock"
common_parametes=" --rm \
--net=host \
--name work"
mkdir -p /mnt/data/emacs/eln-cache
mkdir -p /mnt/data/vim/plugged
if [[ "$mode" == "build" ]]; then
# cd ../docker-emacs/master/ubuntu/18.04/dev/
# docker build -t docker-emacs-native-compilation .
# cd -
docker build -t "$image" .
elif [[ "$mode" == "text" ]]; then
docker run $common_parametes \
--interactive \
--tty \
-e "TERM=xterm-256color" \
$volumes \
"$image"
elif [[ "$mode" == "gui" ]]; then
docker run $common_parametes \
-e DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
$volumes \
"$image"
elif [[ "$mode" == "vim" ]]; then
docker run -it $common_parametes \
-v /tmp/.X11-unix:/tmp/.X11-unix \
$volumes \
"$image" \
/usr/local/bin/nvim
else
echo "usage: $0 [build|text|gui] [image]"
fi