I currently have a Docker compose based web app that uses Nginx as a reverse proxy that forwards traffic to a Flask and Grafana docker instance. The task at hand is to integrate a SSG (static site generator) such as Jekyll into the setup.
The most straight forward approach is to:
- have a Jekyll container continually run and serve the static aspect of the site via Nginx redirects (
jekyll serve
). - Another approach would be to run the build command in the Jekyll docker image and have the output be shared via docker volumes with Nginx.
- Yet another is to generate the site in the Nginx container
The downside with the first two solutions is that they create a Jekyll docker instance that is only used once and then persists. In 1.'s case, the serving can be directly handled by Nginx. In 3.'s case, there is no separation between Jekyll and Nginx. This would be useful since Nginx is also responsible for routing traffic to the other Docker instances.
The question is, is there a way to populate a Docker volume with a Dockerfile by Jekyll so that this can then be mounted by Nginx? Step by step:
docker-compose build
: build the site and populate the static-site volumedocker-compose up -d
: Nginx mounts the static-site volume and serves it
Does this approach even make sense?