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.

25 lines
640 B
Bash

#!/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}:443 \
-v $(pwd):/wd \
--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"