Docker container with sami documentation generator for Korowai project.
627
Docker container with sami documentation generator. The container is designed to build PHP API documentation for Korowai and Korowai Framework out of the box. It may be easily adjusted to support other projects.
With this container you can:
The default behavior is to build continuously and serve at the same time.
Assume we have the following file hierarchy (the essential here is assumption
that php source files are found under src, also we expect the documentation
to be written-out somewhere under docs)
user@pc:$ tree .
.
|-- docs
`-- src
`-- Foo
`-- Bar.php
Run it as follows
user@pc:$ docker run --rm -it -v "$(pwd):/code" -p 8001:8001 korowai/sami
In the top level directory create docker-compose.yml containing the following
version: '3'
# ....
services:
# ...
sami:
image: korowai/sami
ports:
- "8001:8001"
volumes:
- ./:/code
Then run
user@pc:$ docker-compose up sami
Whatever method you chose to run the container, you shall see two new directories
user@pc:$ ls -d docs/*
docs/build docs/cache
The documentation is written to docs/build/html/api
user@pc:$ find docs -name 'index.html'
docs/build/html/api/index.html
As long as the container is running, the documentation is available at
Several parameters can be changed via environment variables, for example we can
change build to build/docs/api dir as follows
user@pc:$ docker run --rm -it -v "$(pwd):/code" -p 8001:8001 -e SAMI_BUILD_DIR=build/docs/api korowai/sami
/code - bind top level directory of your project here./code/usr/local/binautobuild - builds documentation continuously (watches
source directory for changes),autoserve - builds documentation continuously and runs
http server,build - builds documentation once and exits,serve - builds source once and starts http server,sami-defaults - sets DEFAULT_SAMI_xxx variables (defaultsami-env - initializes SAMI_xxx variables,sami-entrypoint - provides an entry point for docker./etc/samisami.conf.php - default configuration file for sami.The container defines several build arguments which are copied to corresponding
environment variables within the running container. Most of the arguments/variables
have names starting with SAMI_ prefix. All the sami-* scripts, and the
configuration file sami.conf.php respect these variables, so the easiest way
to adjust the container to your needs is to set environment variables (-e
flag to docker). KRW_CODE and SAMI_PORT are
exceptions, they must be defined at build time, so they may only be changed via
docker's build arguments.
| Argument | Default Value | Description |
|---|---|---|
| KRW_CODE | /code | Volume mount point and default working directory. |
| SAMI_CONFIG | /etc/sami/sami.conf.php | Path to the config file for sami. |
| SAMI_PROJECT_TITLE | API Documentation | Title for the generated documentation. |
| SAMI_SOURCE_DIR | src:packages | Colon-separated directories with the PHP source files. |
| SAMI_BUILD_DIR | docs/build/html/api | Where to output the generated documentation. |
| SAMI_CACHE_DIR | docs/cache/html/api | Where to write cache files. |
| SAMI_FLAGS | -v --force | Commandline flags passed to sami. |
| SAMI_SERVER_PORT | 8001 | Port numer (within container) for the http server. |
| SAMI_SOURCE_REGEX | `.(php\ | txt\ |
| SAMI_THEME | default | Sami theme. |
Copyright (c) 2018 by Paweł Tomulik [email protected]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
Content type
Image
Digest
Size
37.4 MB
Last updated
over 6 years ago
docker pull korowai/sami