How to Serve the Site with Docker
The repository ships a Caddy image and two Compose files that serve the generated public/ directory in three ways:
-
plain static files
-
static files behind OpenID Connect authentication (for example, Entra ID)
-
static files behind an Authelia forward-auth gate, for local demos
Build the site first with npm run preview, because the image copies public/ at build time.
Prerequisites
-
Docker Engine 24 or later
-
Docker Compose v2 (the
docker composecommand) -
a built
public/directory
Serve the static site
docker build -t antora-site .
docker run --rm -p 8080:80 antora-site
Open http://localhost:8080.
The image is caddy:2-alpine with public/ copied to /usr/share/caddy/ and caddy/Caddyfile as the server config.
Require authentication with OpenID Connect
compose.oidc.yml places oauth2-proxy in front of the static site and authenticates against an OpenID Connect provider such as Entra ID.
Register an application in Entra ID:
-
Add the web redirect URI
http://localhost:4180/oauth2/callback. -
Create a client secret.
Copy .env.example to .env:
cp .env.example .env
Set AZURE_TENANT_ID, AZURE_CLIENT_ID, and AZURE_CLIENT_SECRET from the Entra app registration.
Set OAUTH2_PROXY_COOKIE_SECRET to the output of:
openssl rand -hex 16
Start the stack:
docker compose -f compose.oidc.yml up -d --build
Open http://localhost:4180 and sign in with your Entra account.
Demo authentication with Authelia
compose.authelia.yml gates the site with Authelia and a local demo user, so you can try the authentication flow without an identity provider.
Authelia requires TLS and a real domain.
The demo uses example.com with a self-signed certificate generated by Caddy (tls internal).
Map the demo domains to localhost:
echo "127.0.0.1 example.com auth.example.com" | sudo tee -a /etc/hosts
Start the stack:
docker compose -f compose.authelia.yml up -d --build
Open https://example.com, accept the self-signed certificate warning, and sign in with demo and demo.
Authelia serves its login portal at https://auth.example.com and keeps its runtime data in a Docker volume, so only configuration lives in the repository.
Files
| File | Purpose |
|---|---|
|
Caddy image that serves |
|
plain static server config |
|
forward-auth gate and Authelia portal proxy |
|
static site plus |
|
static site plus Authelia |
|
Authelia configuration and the demo user |
|
OpenID Connect secrets template |
Related
-
Contribute to the project — build and preview the site locally
-
Configuration Reference — extension configuration