Last active
July 18, 2024 00:12
-
-
Save wayhoww/c04c7a79976e5630ce73e3f9aff9aedb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
apt-get update -y && apt-get install htop jq -y | |
name=$(curl --request POST \ | |
--header 'content-type: application/json' \ | |
--url 'https://api.runpod.io/graphql?api_key='$RUNPOD_API_KEY \ | |
--data '{"query": "query Pod { pod(input: {podId: \"'$RUNPOD_POD_ID'\"}) { name } }"}') | |
name=$(echo $name | jq -r '.data.pod.name') | |
cat >> /root/.bashrc <<EOF | |
export VSCODE_CLI_DISABLE_KEYCHAIN_ENCRYPT=1 | |
export VSCODE_CLI_USE_FILE_KEYCHAIN=1 | |
export PATH=$PATH:/root/.local/bin | |
export RUNPOD_POD_NAME=$name | |
EOF | |
export PATH=$PATH:/root/.local/bin | |
export VSCODE_CLI_USE_FILE_KEYCHAIN=1 | |
export VSCODE_CLI_DISABLE_KEYCHAIN_ENCRYPT=1 | |
export RUNPOD_POD_NAME=$name | |
. /root/.bashrc | |
mkdir -p /workspace/.local/bin | |
rm -rf /root/.local | |
ln -s /workspace /root/workspace | |
ln -s /workspace/.local /root/.local | |
ln -s /workspace/.config /root/.config | |
ln -s /workspace/.gitconfig /root/.gitconfig | |
curl -L 'https://code.visualstudio.com/sha/download?build=stable&os=cli-alpine-x64' --output /tmp/vscode_cli.tar.gz | |
tar -xf /tmp/vscode_cli.tar.gz -C /workspace/.local/bin --no-same-owner | |
curl -L 'https://gist.github.com/wayhoww/8ebbcf31d95ae66c9828e3fba6866dfd/raw' --output /workspace/.local/sendmail.py | |
bash /workspace/.local/setup-env.sh | |
echo "Naming it as: $name" | |
/workspace/.local/bin/code tunnel --name $name --cli-data-dir /workspace/.vscode/cli-$name/ --server-data-dir /workspace/.vscode-server --extensions-dir /workspace/.vscode-server --accept-server-license-terms |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment