Skip to content

Commit 6718974

Browse files
authored
Merge pull request #29 from CBroz1/docs
Add docs compose file
2 parents cb4b40a + 1481794 commit 6718974

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,5 +112,4 @@ dj_local_conf_old.json
112112
**/#*#
113113
**/.#*
114114

115-
docker-compose.y*ml
116115
.DS_Store

docs/docker-compose.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# MODE="LIVE|QA|PUSH" PACKAGE=element_session UPSTREAM_REPO=https://github.com/datajoint/element-session.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+
- GOOGLE_ANALYTICS_KEY
18+
- PATCH_VERSION
19+
volumes:
20+
- ../docs:/main/docs
21+
- ../${PACKAGE}:/main/${PACKAGE}
22+
user: ${HOST_UID}:anaconda
23+
ports:
24+
- 80:80
25+
command:
26+
- sh
27+
- -c
28+
- |
29+
git config --global --add safe.directory /main
30+
set -e
31+
export PATCH_VERSION=$$(cat /main/$${PACKAGE}/version.py | grep -oE '\d+\.\d+\.[a-z0-9]+')
32+
if echo "$${MODE}" | grep -i live &>/dev/null; then
33+
mkdocs serve --config-file ./docs/mkdocs.yaml -a 0.0.0.0:80
34+
elif echo "$${MODE}" | grep -iE "qa|push" &>/dev/null; then
35+
echo "INFO::Delete gh-pages branch"
36+
git branch -D gh-pages || true
37+
echo "INFO::Fetch upstream gh-pages"
38+
git fetch $${UPSTREAM_REPO} gh-pages:gh-pages && git switch gh-pages || git switch --orphan gh-pages && git commit --allow-empty -m "init commit"
39+
echo "INFO::mike"
40+
mike deploy --config-file ./docs/mkdocs.yaml -u $$(grep -oE '\d+\.\d+' /main/$${PACKAGE}/version.py) latest
41+
mike set-default --config-file ./docs/mkdocs.yaml latest
42+
if echo "$${MODE}" | grep -i qa &>/dev/null; then
43+
mike serve --config-file ./docs/mkdocs.yaml -a 0.0.0.0:80
44+
elif echo "$${MODE}" | grep -i push &>/dev/null; then
45+
echo "INFO::Push gh-pages to upstream"
46+
git push $${UPSTREAM_REPO} gh-pages
47+
fi
48+
else
49+
echo "Unexpected mode..."
50+
exit 1
51+
fi

0 commit comments

Comments
 (0)