-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use separate docker worker for serving docs
The worker Docker image for serving docs requires - Bash for running the `git-elegant` binary and collecting the docs - Python for running `docs.py` and `mkdocs` The `.workflows/docs/Dockerfile` installs these dependencies as well as `docs-workflows.bash` script that provides the following commands: - `generate` for generating the `docs/commands.md` file - `build` for building a static docs site using `mkdocs` - `preview` for running docs site All logic of worker image creation and usage is moved to `workflows` script. However, the docs can be served without Docker just by using `.workflows/docs/docs-workflows.bash` script - it is not recommended way, but, sometimes, it is useful during debugging.
- Loading branch information
Showing
6 changed files
with
145 additions
and
37 deletions.
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
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,16 @@ | ||
ARG pythonversion=3.8.3 | ||
FROM python:${pythonversion}-alpine | ||
LABEL maintainer="Dmytro Serdiuk <[email protected]>" \ | ||
description="The image serves the environment for docs development of Elegant Git." | ||
VOLUME /elegant-git | ||
WORKDIR /elegant-git | ||
ENV EG_ENABLE_TESTING true | ||
EXPOSE 80 | ||
ENTRYPOINT [ "/docs-workflows.bash" ] | ||
CMD ["help"] | ||
COPY docs/requirements.txt . | ||
RUN python -m pip install --upgrade pip && \ | ||
python -m pip install -r requirements.txt | ||
ARG bashversion=5.0.17 | ||
RUN apk add --no-cache bash~=${bashversion} | ||
COPY .workflows/docs/docs-workflows.bash / |
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,33 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
generate() { | ||
exec python .workflows/docs/docs.py | ||
} | ||
|
||
build() { | ||
local site_directory=/tmp/elegnat-git-docs | ||
if test -z "${EG_ENABLE_TESTING}"; then | ||
site_directory=$(pwd)/elegnat-git-docs | ||
fi | ||
exec python -m mkdocs build --clean --strict --site-dir ${site_directory} | ||
} | ||
|
||
preview() { | ||
exec python -m mkdocs serve --dev-addr 0.0.0.0:80 | ||
} | ||
|
||
help() { | ||
cat <<MESSAGE | ||
usage: ${BASH_SOURCE[0]} <command> | ||
Available commands: | ||
help prints this message | ||
generate generates fresh commands documentation | ||
build builds the static documentation site | ||
preview previews the documentation site | ||
MESSAGE | ||
} | ||
|
||
${1} |
File renamed without changes.
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
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