forked from emqx/emqx-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
preview.sh
executable file
·37 lines (32 loc) · 1.35 KB
/
preview.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
set -euo pipefail
## this script is to run a docker container to
## 1. render the markdown files for vuepress
## 2. serve the rendered HTML pages in a vuepress site
##
## It takes one argument as the listner port number the
## port number which defaults to 8080
PRODUCT="${1:-ce}" # ce or ee
PORT="${2:-8080}"
THIS_DIR="$(cd "$(dirname "$(readlink "$0" || echo "$0")")"; pwd -P)"
docker rm emqx-doc-preview > /dev/null 2>&1 || true
if [ "$PRODUCT" = "ce" ]; then
python3 "$THIS_DIR/gen.py" ce > directory.json
docker run -p ${PORT}:8080 -it --name emqx-doc-preview \
-v "$THIS_DIR"/directory.json:/app/docs/.vuepress/config/directory.json \
-v "$THIS_DIR"/en_US:/app/docs/en/latest \
-v "$THIS_DIR"/zh_CN:/app/docs/zh/latest \
-v "$THIS_DIR"/swagger:/app/docs/.vuepress/public/api \
-e DOCS_TYPE=broker \
-e VERSION=latest \
ghcr.io/emqx/emqx-io-docs-frontend:latest
else
python3 "$THIS_DIR/gen.py" ee > directory_ee.json
docker run -p ${PORT}:8080 -it --name emqx-doc-preview \
-v "$THIS_DIR"/directory_ee.json:/app/docs/.vuepress/config/directory.json \
-v "$THIS_DIR"/en_US:/app/docs/en/enterprise/latest \
-v "$THIS_DIR"/zh_CN:/app/docs/zh/enterprise/latest \
-e DOCS_TYPE=enterprise \
-e VERSION=latest \
ghcr.io/emqx/docs-emqx-com-frontend:latest
fi