Skip to content

Instantly share code, notes, and snippets.

@spacelatte
Last active May 22, 2019 07:54
Show Gist options
  • Save spacelatte/d07e5d1f1ecce5be7c61d81bacdfae27 to your computer and use it in GitHub Desktop.
Save spacelatte/d07e5d1f1ecce5be7c61d81bacdfae27 to your computer and use it in GitHub Desktop.
react docker bash quick start
#!/bin/bash
which docker > /dev/null || {
echo "Docker not found! which is required!"
exit 1
}
test -z "$1" && {
echo "Easy Usage: $0 app-name [port]" 1>&2
docker run --rm -itv "$(pwd):/data" -p 9005:9005 -p ${PORT:-3000}:3000 pvtmert/react
exit
}
APPNAME=${1:-test}
PORT=${2:-3000}
test -e "$APPNAME" || docker run --rm -itv "$(pwd):/data" -p $PORT:3000 pvtmert/react create-react-app "$APPNAME"
docker run --rm -itv "$(pwd)/$APPNAME:/data" -p $PORT:3000 pvtmert/react yarn start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment