Last active
July 20, 2024 06:05
-
-
Save wayhoww/dd4e03f83afb1354c1e9c8387f20f7a1 to your computer and use it in GitHub Desktop.
Dockerfile for Cloud ML
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
FROM runpod/pytorch:2.2.1-py3.10-cuda12.1.1-devel-ubuntu22.04 | |
RUN apt-get update -y \ | |
&& apt-get install -y htop jq gh vim git-lfs tmux tree \ | |
&& git lfs install \ | |
&& 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 /usr/bin --no-same-owner \ | |
&& rm /tmp/vscode_cli.tar.gz \ | |
&& curl -L 'https://gist.github.com/wayhoww/8ebbcf31d95ae66c9828e3fba6866dfd/raw' --output /usr/bin/sendmail \ | |
&& chmod +x /usr/bin/sendmail \ | |
&& pip install matplotlib scipy pandas scikit-learn | |
COPY start /usr/bin/start | |
ENV VSCODE_CLI_USE_FILE_KEYCHAIN=1 VSCODE_CLI_DISABLE_KEYCHAIN_ENCRYPT=1 TZ="Asia/Shanghai" | |
WORKDIR /workspace | |
CMD ["/usr/bin/start"] |
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 | |
trap 'bash /workspace/.local/sigterm_callback.sh' SIGTERM | |
# if RUNPOD_POD_ID is set, then get name from api | |
if [ -z "$RUNPOD_POD_ID" ]; then | |
name='cloud-ml-instance' | |
else | |
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') | |
fi | |
export PATH=$PATH:/workspace/.local/bin | |
export RUNPOD_POD_NAME=$name | |
echo "$name" > /etc/podname | |
if [ -f "/workspace/.local/setup-env.sh" ]; then | |
source /workspace/.local/setup-env.sh | |
fi | |
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 & | |
if [ -n "$1" ]; then | |
echo "Running command: $*" | |
echo "$*" > /etc/command | |
bash -c "$*" & | |
fi | |
wait |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment