-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from tdincer/main
add docker-compose for docs
- Loading branch information
Showing
2 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,4 +114,3 @@ dj_local_conf_old.json | |
**/*~ | ||
**/#*# | ||
**/.#* | ||
docker-compose.y*ml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# MODE="LIVE|QA|PUSH" PACKAGE=element_interface UPSTREAM_REPO=https://github.com/datajoint/element-interface.git HOST_UID=$(id -u) docker compose -f docs/docker-compose.yaml up --build | ||
# | ||
# navigate to http://localhost/ | ||
version: "2.4" | ||
services: | ||
docs: | ||
build: | ||
dockerfile: docs/.docker/Dockerfile | ||
context: ../ | ||
args: | ||
- PACKAGE | ||
image: ${PACKAGE}-docs | ||
environment: | ||
- PACKAGE | ||
- UPSTREAM_REPO | ||
- MODE | ||
- GOOGLE_ANALYTICS_KEY | ||
- PATCH_VERSION | ||
volumes: | ||
- ../docs:/main/docs | ||
- ../${PACKAGE}:/main/${PACKAGE} | ||
user: ${HOST_UID}:anaconda | ||
ports: | ||
- 80:80 | ||
command: | ||
- sh | ||
- -c | ||
- | | ||
git config --global --add safe.directory /main | ||
set -e | ||
export PATCH_VERSION=$$(cat /main/$${PACKAGE}/version.py | grep -oE '\d+\.\d+\.[a-z0-9]+') | ||
if echo "$${MODE}" | grep -i live &>/dev/null; then | ||
mkdocs serve --config-file ./docs/mkdocs.yaml -a 0.0.0.0:80 | ||
elif echo "$${MODE}" | grep -iE "qa|push" &>/dev/null; then | ||
echo "INFO::Delete gh-pages branch" | ||
git branch -D gh-pages || true | ||
echo "INFO::Fetch upstream gh-pages" | ||
git fetch $${UPSTREAM_REPO} gh-pages:gh-pages && git switch gh-pages || git switch --orphan gh-pages && git commit --allow-empty -m "init commit" | ||
echo "INFO::mike" | ||
mike deploy --config-file ./docs/mkdocs.yaml -u $$(grep -oE '\d+\.\d+' /main/$${PACKAGE}/version.py) latest | ||
mike set-default --config-file ./docs/mkdocs.yaml latest | ||
if echo "$${MODE}" | grep -i qa &>/dev/null; then | ||
mike serve --config-file ./docs/mkdocs.yaml -a 0.0.0.0:80 | ||
elif echo "$${MODE}" | grep -i push &>/dev/null; then | ||
echo "INFO::Push gh-pages to upstream" | ||
git push $${UPSTREAM_REPO} gh-pages | ||
fi | ||
else | ||
echo "Unexpected mode..." | ||
exit 1 | ||
fi |