Build script, search index, tags

This commit is contained in:
Vincent Fiduccia
2018-05-08 11:53:24 -07:00
parent 4e902c8819
commit 151e5da755
3 changed files with 26 additions and 11 deletions
+20 -5
View File
@@ -1,7 +1,11 @@
#!/bin/bash
set -e
PORT=9001
IMAGE=rancher/docs
TAG=dev
THEME=
BUILD=
# cd to app root
CWD=$(dirname $0)
@@ -16,8 +20,9 @@ print_help()
cat 1>&2 <<EOF
Usage:
[-p PORT] [-t]
[-n] [-p PORT] [-t]
-b - Build the image instead of pulling from the registry
-p PORT - Port to listen on
-t DIR - Use DIR to for the theme, to devlop the theme at the same time
@@ -35,8 +40,11 @@ absolute() {
}
while getopts ":p:t:" opt;do
while getopts ":bp:t:" opt;do
case $opt in
b)
BUILD="true"
;;
p)
PORT="${OPTARG}"
;;
@@ -57,12 +65,19 @@ while getopts ":p:t:" opt;do
done
THEMEVOLUME=""
echo "Starting server on http://localhost:${PORT}"
if [[ "$THEME" ]]; then
echo "Using theme from ${THEME}"
ABSOLUTE=$(absolute $THEME)
THEMEVOLUME="-v ${ABSOLUTE}:/run/node_modules/rancher-website-theme"
fi
docker pull rancher/docs:dev
docker run --rm -p ${PORT}:${PORT} -it -v $(pwd):/site ${THEMEVOLUME} rancher/docs:dev dev --port=${PORT}
if [ -z "$BUILD" ]; then
docker pull ${IMAGE}:${TAG}
else
echo "Building ${IMAGE}:${TAG}"
TAG=local
docker build -f Dockerfile.dev -t ${IMAGE}:${TAG} .
fi
echo "Starting server on http://localhost:${PORT}"
docker run --rm -p ${PORT}:${PORT} -it -v $(pwd):/site ${THEMEVOLUME} ${IMAGE}:${TAG} dev --port=${PORT}