Docker image

If you have to distribute a Zola based web site through Docker, it's easy to do with a multi-stage build.

Here is an example that builds the current folder, and put the result in a docker image that will be served by static-web-server, a minimalist web server written in rust.

Of course, you may want to replace the second stage with another static web server like Nginx or Apache.

FROM as zola

COPY . /project
WORKDIR /project
RUN ["zola", "build"]

COPY --from=zola /project/public /public

To build your website as a docker image, you then run:

docker build -t my_website:latest .

To test your site, just run the docker image and browse http://localhost:8000

docker run --rm -p 8000:80 my_website:latest

Note that, if you want to be able to use your docker image from multiple locations, you'll have to set base_url to /.