What's Zola?
Powered by Zola, a static site generator written in Rust π¦, I've brought this blog to life β a long-held aspiration of mine. Creating a platform to showcase my projects and ideasπ‘
Checkout its repository on Github! π
How to 'self-host' Zola? π
Well... There are many ways to deploy Zola in a self-hosted environment or even on platforms like Netlify or Vercel. Checkout the official deployment guide on getzola.org
I chose to deploy it in my own Docker environment and therefore created some Docker scripts. I decided to create a custom Docker image which is newly built every time I make changes to my blog page. I want to automate this process, but currently, I am just doing it manually... Here are the steps!
Let's asume the Docker Scripts are in the project's root directory:
βββ config.toml
βββ content
βββ docker-compose.yaml
βββ Dockerfile
βββ sass
βββ static
βββ templates
βββ themes
Create the Dockerfile
with following contents:
FROM ghcr.io/getzola/zola:v0.18.0 as zola
COPY . /project
WORKDIR /project
RUN ["zola", "build", "--base-url", "/"]
FROM ghcr.io/static-web-server/static-web-server:2
WORKDIR /
COPY --from=zola /project/public /public
The above Dockerfile is taken from the offical documentation - slightly modified
Create the docker-compose.yaml
file with following contents:
version: "3.3"
services:
my-website:
build:
context: .
dockerfile: Dockerfile
ports:
- "8080:80"
restart: always
Build and run the container by executing docker compose up --build