Docker for BookStack
After looking for a documentation program for both the products I sell and the Keep Dreaming Project I stumbled on BookStack which seemed to fit the bill. Since I use Docker Swarm and relatively cheap VPS’s to host my websites I often wind up either modifying or making new Docker images to make them more lightweight and to better suit my usecase.
In this case, I started with solidnerd’s docker-bookstack which at the time used a Debian based container that ran both PHP and Apache. Now the ‘Docker way’ is to try and separate things as much as possible into microservices, so a container running both PHP and Apache wasn’t ideal. I switched to using an Alpine-based container for PHP and ditched Apache entirely and used a separate NGINX container for the webserver, this reduced the image size by 50-60%.
Since I was using Docker Swarm I added a script to parse Docker secrets so passwords wouldn’t need to be saved in the Docker Compose file. I added the ability to fine-tune some of PHP’s performance parameters which can be changed by using various environment variables at run time. I also set up hooks for when Docker Hub builds the Docker images, this passes in information when the build is run which I mainly use to pass in the BookStack version number by querying the git tag. All in all, I probably wound up rewriting 90% of the project.