Last active
February 28, 2021 03:47
-
-
Save zachbogart/c01e88886855c39c4058d0baa43ec9ec to your computer and use it in GitHub Desktop.
Vanillin: oh-my-zsh plugin to make using JupyterLab in Docker images easier (https://github.com/zachbogart/vanillin)
This file contains 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
# vanillin: alias for docker build/run JupyterLab | |
# https://github.com/zachbogart/vanillin | |
vanillin() { | |
EMOJI=🍦 | |
if [ "$#" = 1 ] | |
then | |
echo "$EMOJI" | |
echo "$EMOJI Building image \"$1\" from this directory's Dockerfile..." | |
echo "$EMOJI" | |
docker build --rm -t "$1" . | |
elif [ "$#" = 2 ] | |
then | |
echo "$EMOJI" | |
echo "$EMOJI Opening JupyterLab from image \"$1\" on port $2" | |
echo "$EMOJI" | |
echo "$EMOJI http://localhost:$2" | |
echo "$EMOJI" | |
docker run --rm -p "$2":8888 -e JUPYTER_ENABLE_LAB=yes -v "$PWD":/home/jovyan/work "$1" | |
else | |
echo "$EMOJI" | |
echo "$EMOJI Vanillin: alias for docker build/run JupyterLab commands" | |
echo "$EMOJI - GitHub: https://github.com/zachbogart/vanillin" | |
echo "$EMOJI" | |
echo "$EMOJI Usage:" | |
echo "$EMOJI" | |
echo "$EMOJI vanillin name" | |
echo "$EMOJI Alias for: \`docker build --rm -t name .\`" | |
echo "$EMOJI - Shorthand for building image from pwd Dockerfile" | |
echo "$EMOJI" | |
echo "$EMOJI vanillin name port" | |
echo "$EMOJI Alias for: \`docker run --rm -p port:8888 -e JUPYTER_ENABLE_LAB=yes -v "\$PWD":/home/jovyan/work name\`" | |
echo "$EMOJI - Shorthand for running JupyterLab" | |
echo "$EMOJI" | |
echo "$EMOJI -- Example --" | |
echo "$EMOJI" | |
echo "$EMOJI Build \`cool_image_name\` from pwd Dockerfile" | |
echo "$EMOJI and run JupyterLab on the result, on port 10000" | |
echo "$EMOJI" | |
echo "$EMOJI 1. \`vanillin cool_image_name\`" | |
echo "$EMOJI 2. \`vanillin cool_image_name 10000\`" | |
echo "$EMOJI" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment