mirror of
https://github.com/rancher/rancher-docs.git
synced 2026-09-10 11:15:49 +00:00
Build script, search index, tags
This commit is contained in:
+20
-5
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user