Last active
February 13, 2019 00:36
-
-
Save jrnickell/bd57577a22ea5534ad79 to your computer and use it in GitHub Desktop.
Docker Python HTTP Server
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
#!/usr/bin/env bash | |
# place in ~/bin or a PATH directory | |
# | |
# usage: | |
# | |
# $ cd /path/to/site | |
# $ serve-static 8443 | |
# | |
# port number defaults to 8000 | |
if [[ -z $1 ]]; then | |
SERVE_PORT="8000" | |
else | |
SERVE_PORT="$1" | |
fi | |
docker run -v $(pwd):$(pwd) -w $(pwd) -p 0.0.0.0:$SERVE_PORT:$SERVE_PORT -it --rm --name="python-http-server" python:2.7 python -m SimpleHTTPServer $SERVE_PORT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment