docmachine-containers/scripts/gx-teaching

38 lines
921 B
Text
Raw Normal View History

2021-11-23 22:48:06 +00:00
#!/bin/sh
# vim: set ft=sh:
BASEDIR="${1:-.}"
BASEDIR="$(cd "$BASEDIR" && pwd)"
ACTION="${2:-watch}"
DOCKER_IMAGE=glenux/teaching-boilerplate:latest
echo "basedir = $BASEDIR"
echo "docker_image = $DOCKER_IMAGE"
echo "action = $ACTION"
2021-11-25 16:52:03 +00:00
if [ -f "$BASEDIR/.marp/theme.scss" ]; then
2021-11-24 18:35:20 +00:00
DOCKER_OPT_MARP_THEME="-v $BASEDIR/.marp:/app/.marp"
2021-11-25 16:52:03 +00:00
echo "Theme: detected Marp files. Adding option to command line ($DOCKER_OPT_MARP_THEME)"
else
echo "Theme: no theme detected. Using default files"
2021-11-24 18:35:20 +00:00
fi
2021-11-23 22:48:06 +00:00
docker run -it \
-v "$BASEDIR/docs:/app/docs" \
-v "$BASEDIR/slides:/app/slides" \
2021-11-25 17:44:46 +00:00
-v "$BASEDIR/images:/app/images" \
2021-11-23 22:48:06 +00:00
-v "$BASEDIR/_build:/app/_build" \
-v "$BASEDIR/mkdocs.yml:/app/mkdocs.yml" \
2021-11-30 14:01:01 +00:00
-e "EXT_UID=$(id -u)" \
-e "EXT_GID=$(id -g)" \
2021-11-24 18:35:20 +00:00
$DOCKER_OPT_MARP_THEME \
2021-11-23 22:48:06 +00:00
-p 5200:5200 \
-p 5100:5100 \
"$DOCKER_IMAGE" "$ACTION"
# TODO: ask current user permissions
# TODO: fix permissions on generated files