Unverified Commit 59423746 authored by Glenn Walbran's avatar Glenn Walbran
Browse files

WR340583, Add a dockerized nginx web server for serving built docs

Some parts of the documentation cannot be tested by opening the html
files with a browser. For instance search will not work in that case.

The solution is to serve the built files with a nginx web server
running in a docker container. Add a script to do this along with
instructions.
parent 1b4dddd9
......@@ -19,6 +19,10 @@ The first command only builds English. The second builds all translations
manual-build/build-manual.sh TRANSLATIONS=en html
manual-build/build-manual.sh html
manual-build/local-server.sh start
# check your changes in site served from the local server
manual-build/local-server.sh stop
```
The built docs will be in the `build/html` directory (on your host machine).
......
#!/bin/bash
#
# Runs a dockerized nginx web server that will serve the Mahara manual
# that has been built.
#
# This script will start the nginx container and publish it's port 80 to
# ${CONTAINER_LISTEN_PORT} which will default to port 80 on the host machine.
# If this does not suit you set an environment variable CONTAINER_LISTEN_PORT
# with the port that you do want to use.
CONTAINTER_NAME=${CONTAINTER_NAME:-mahara-nginx}
CONTAINER_LISTEN_PORT=${CONTAINER_LISTEN_PORT:-80}
cd $(dirname $0)/..
if [[ "$1" == "stop" ]] ; then
docker container stop ${CONTAINTER_NAME}
elif [[ "$1" == "start" ]] ; then
docker run --rm --name ${CONTAINTER_NAME} \
-p ${CONTAINER_LISTEN_PORT}:80 \
-v $(pwd)/build/html:/usr/share/nginx/html:ro \
-d nginx
echo "View the manual at http://localhost:${CONTAINER_LISTEN_PORT}/en/"
else
echo "Usage $0 start|stop"
fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment