Skip to content

Commit 36757af

Browse files
committed
Add docker compose for mkdocs deployment
1 parent 14d815b commit 36757af

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ mym/
44
notebook
55
*getSchema.m
66
docker-compose*.y*ml
7+
!docs/docker-compose.yaml
78
.vscode
89
matlab.prf
910
win.*

docs/docker-compose.yaml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# MODE="LIVE" PACKAGE=datajoint UPSTREAM_REPO=https://github.com/datajoint/datajoint-matlab.git HOST_UID=$(id -u) docker compose -f docs/docker-compose.yaml up --build
2+
#
3+
# navigate to http://localhost/
4+
version: "2.4"
5+
services:
6+
docs:
7+
build:
8+
dockerfile: docs/.docker/Dockerfile
9+
context: ../
10+
args:
11+
- PACKAGE
12+
image: ${PACKAGE}-docs
13+
environment:
14+
- PACKAGE
15+
- UPSTREAM_REPO
16+
- MODE
17+
volumes:
18+
- ..:/main
19+
user: ${HOST_UID}:anaconda
20+
ports:
21+
- 80:80
22+
command:
23+
- sh
24+
- -c
25+
- |
26+
set -e
27+
if echo "$${MODE}" | grep -i live &>/dev/null; then
28+
mkdocs serve --config-file ./docs/mkdocs.yaml -a 0.0.0.0:80
29+
elif echo "$${MODE}" | grep -iE "qa|build" &>/dev/null; then
30+
git branch -D gh-pages || true
31+
git fetch $${UPSTREAM_REPO} gh-pages:gh-pages || true
32+
mike deploy --config-file ./docs/mkdocs.yaml -u $$(grep -oE '\d+\.\d+' /main/$${PACKAGE}/version.py) latest
33+
mike set-default --config-file ./docs/mkdocs.yaml latest
34+
if echo "$${MODE}" | grep -i qa &>/dev/null; then
35+
mike serve --config-file ./docs/mkdocs.yaml -a 0.0.0.0:80
36+
fi
37+
else
38+
echo "Unexpected mode..."
39+
exit 1
40+
fi

0 commit comments

Comments
 (0)