Publish as a container
Package the site with a small web server into a container image, for Docker, Podman, Kubernetes or a container hosting service.
Write publish.yaml
targets:
image:
type: container
image: ${REGISTRY}/example-site:latest
server: nginx # or caddy
push: false # true sends it to the registry
# csp: true # also send the security policy the pages need
Publish
hotdog-cms publish image
HotDog builds and checks the site, then builds an image with the site and a small web server (nginx or Caddy), listening on port 8080. It needs Podman or Docker installed (it uses whichever it finds). With push: true, it's sent to the registry in image (sign in first with docker login or podman login).
Run it
docker run -d -p 80:8080 registry.example.org/example-site:latest
Use the image name from your publish.yaml, with ${REGISTRY} filled in.
The web server inside already has the right settings for a HotDog site: the "page not found" page, caching, calendar feeds. With csp: true, it also sends the strict security policy your pages need (see check -csp).
Run it locked down
The image only serves files, so it can run with almost everything a container is allowed taken away. Both web servers run as an ordinary user on port 8080 (nginx as user 101; Caddy, from HotDog 0.3.3, as nobody with its admin interface switched off), so the same settings work for either:
docker run -d -p 80:8080 \
--read-only \
--tmpfs /tmp:rw,noexec,nosuid,nodev \
--cap-drop ALL --security-opt no-new-privileges \
--memory 256m --pids-limit 128 \
registry.example.org/example-site:latest
What each part does:
| Setting | What it stops |
|---|---|
--read-only |
Anything changing the image while it runs. |
--tmpfs /tmp:…,noexec |
/tmp is the one place it can write, and nothing written there can run. |
--cap-drop ALL |
Every special power a Linux process can hold, down to binding a low port. |
--security-opt no-new-privileges |
Gaining any of them back, by any means. |
--memory, --pids-limit |
One site using up a machine it shares with others. A HotDog site uses under 10 MB and a handful of processes. |
In Kubernetes, the same thing is a securityContext with readOnlyRootFilesystem: true, allowPrivilegeEscalation: false, capabilities: { drop: [ALL] }, runAsNonRoot: true, and an emptyDir mounted at /tmp.
For what moving a site this way gains, in numbers, see A site you built yourself.
Building images in your own pipeline
If your pipeline builds images itself, context: writes only the image's build folder (the site and a Dockerfile), without building it:
context: build/image

