Posted on

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