Skip to content

Commit e6bf304

Browse files
authored
Merge pull request #418 from CBroz1/master
Add docker compose for mkdocs deployment
2 parents 14d815b + 39b2e5d commit e6bf304

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-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

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
export PATCH_VERSION=$$(cat /main/+dj/version.m | grep 'v =' | sed 's/[^0-9]*/./g' | cut -c 2-6)
28+
if echo "$${MODE}" | grep -i live &>/dev/null; then
29+
mkdocs serve --config-file ./docs/mkdocs.yaml -a 0.0.0.0:80
30+
elif echo "$${MODE}" | grep -iE "qa|build" &>/dev/null; then
31+
git branch -D gh-pages || true
32+
git fetch $${UPSTREAM_REPO} gh-pages:gh-pages || true
33+
mike deploy --config-file ./docs/mkdocs.yaml -u $PATCH_VERSION latest
34+
mike set-default --config-file ./docs/mkdocs.yaml latest
35+
if echo "$${MODE}" | grep -i qa &>/dev/null; then
36+
mike serve --config-file ./docs/mkdocs.yaml -a 0.0.0.0:80
37+
fi
38+
else
39+
echo "Unexpected mode..."
40+
exit 1
41+
fi

0 commit comments

Comments
 (0)