Zola + Nginx + Docker

2023-03-14

Edited 2023-11-24

This page is contained entirely in a single Docker image, which is about 42M in size.

# Dockerfile
FROM alpine:edge AS builder

RUN apk add zola

RUN mkdir /src
WORKDIR /src

COPY . /src

RUN zola build

# --

FROM nginx:1.25.3-alpine

COPY --from=builder /src/public /usr/share/nginx/html

# optional: nginx config
COPY nginx.conf /etc/nginx/conf.d/default.conf
# nginx.conf
server {
    listen       80;
    listen  [::]:80;
    server_name _;

    access_log /var/log/nginx/host.access.log  main;

    gzip on;
    gzip_comp_level 6;
    gzip_types
        text/html
        text/css
        application/javascript
        image/svg+xml
        font/woff2;

    root /usr/share/nginx/html;
    error_page 404 /404.html;

    location / {
        index index.html;
    }
}

Edits

  • 24.11.2023: Updated dockerfile, added nginx configuration to this post

Migraines and bad days
    Madness and caffeine
        I welcome you with open arms and a handful of Advil
                        

~

a lily

Copyright © 2023 Jonni Liljamo
All Rights Reserved