-
Notifications
You must be signed in to change notification settings - Fork 0
/
make-python-dev.sh
executable file
·51 lines (34 loc) · 1.35 KB
/
make-python-dev.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
#!/bin/bash
set -x
docker_name_prefix='python-dev'
if [ -n "$1" ] ; then
docker_name_prefix=$1
fi
ssh_port='5122'
if [ -n "$2" ] ; then
ssh_port=$2
fi
docker_name="$docker_name_prefix-$ssh_port"
docker_file='Dockerfiles/Dockerfile'
if [ -n "$3" ] ; then
docker_file=$3
fi
echo "Creating $docker_name from Dockerfile $docker_file"
if [ ! -f ~/.ssh/docker_dev ] ; then
echo "Please generate docker_dev ssh key"
fi
sed "s/CONTAINER_NAME/$docker_name/g" Install-Files/bash_profile_template > Install-Files/bash_profile
sed "s#HOME#$HOME#g" Install-Files/install-emacs-template.sh > Install-Files/install-emacs.sh
chmod a+x Install-Files/install-emacs.sh
#docker build -t your-base-image . # optional if you want this in here
docker build -f "$docker_file" \
--build-arg AUTH_KEY="$(cat ~/.ssh/docker_dev.pub)" \
-t "$docker_name_prefix:latest" .
# -V $(pwd):$(pwd) will align our pycharm project's directory structure with docker's
docker run -d -p "127.0.0.1:$ssh_port:5022" \
--name $docker_name \
-v $HOME:$HOME "$docker_name_prefix:latest" /usr/sbin/sshd -D # run sshd without detach
# docker run -d -p "127.0.0.1:$ssh_port:5022" \
# -p "127.0.0.1:8888:8888"\
# --name $docker_name \
# -v $HOME:$HOME "$docker_name_prefix:latest" /usr/sbin/sshd -D # run sshd without detach