-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathactivate.sh
More file actions
executable file
·28 lines (26 loc) · 1.04 KB
/
activate.sh
File metadata and controls
executable file
·28 lines (26 loc) · 1.04 KB
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
#!/usr/bin/env sh
set -xe
# shellcheck source=/dev/null
. "./virtualdenv.cfg"
export PYTHON_VERSION
project_dir_host=$(pwd)
project_dir_container="/home/${USER}/code"
venv_dir_host="$(pwd)/venv"
venv_dir_container="/opt/venv"
ssh_dir_host="$(pwd)/.ssh"
ssh_dir_container="/home/${USER}/.ssh"
image_repo="virtualdenv:${PYTHON_VERSION}"
host_name="host.docker.internal:host-gateway"
docker run \
--rm \
--mount type=bind,source="${venv_dir_host}",target=${venv_dir_container} \
--mount type=bind,source="${project_dir_host}",target="${project_dir_container}" \
--mount type=bind,source="${ssh_dir_host}",target="${ssh_dir_container}" \
--interactive \
--tty \
--env TERM="xterm-256color" \
--env PRE_COMMIT_HOME="${project_dir_container}/.cache" \
--add-host=${host_name} \
--network host \
"${image_repo}" \
/bin/sh -c "git config --global user.email $(git config user.email) && git config --global user.name $(git config user.name) && python -m venv $venv_dir_container && PATH=${venv_dir_container}/bin:${PATH} && python -m pip install --upgrade pip && bash"