You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
691 B
Bash
27 lines
691 B
Bash
2 months ago
|
#!/bin/bash
|
||
|
CURDIRNAME=${PWD##*/}
|
||
|
|
||
|
VSCODE_PORT=8400
|
||
|
YOURAPP_INSIDE_DOCKER_PORT=24000
|
||
|
PASSWORD=$(openssl rand -base64 45)
|
||
|
docker run \
|
||
|
-d \
|
||
|
--rm \
|
||
|
--gpus "device=0" \
|
||
|
-p ${VSCODE_PORT}:8443 \
|
||
|
-p ${YOURAPP_INSIDE_DOCKER_PORT}:7443 \
|
||
|
-v $(pwd):/wd \
|
||
|
-v /home/${USER}/.ssh/:/home/${USER}/.ssh/:ro \
|
||
|
--shm-size=10gb \
|
||
|
--name ${USER}_${CURDIRNAME}_vscode \
|
||
|
-e PASSWORD="${PASSWORD}" \
|
||
|
${USER}_${CURDIRNAME}_vscode \
|
||
|
code-server
|
||
|
sleep 1
|
||
|
docker logs ${USER}_${CURDIRNAME}_vscode
|
||
|
echo ""
|
||
|
echo "Address: https://$(hostname -i | awk '{ print $1; }'):${VSCODE_PORT}"
|
||
|
echo "Password: $PASSWORD"
|
||
|
echo ""
|
||
|
echo "You can use this port for application you develop: $YOURAPP_INSIDE_DOCKER_PORT"
|