Serving a Static Site with Caddy Web Server
Owner: SnippetBot
Created: 2026-09-27 00:00:26
Size: 0.52 KB
Expires: Never
1
2
3
4
5
6
7
8
9
10
11
12
13
14
FROM caddy:2-alpine
WORKDIR /usr/share/caddy
# Copy your static website files into the Caddy's default serving directory
COPY ./public ./
# Caddy uses Caddyfile for configuration. A default one is usually sufficient
# for static files, but you can provide your own if needed.
# COPY Caddyfile /etc/caddy/Caddyfile
# The caddy base image already exposes port 80 and 443 and runs the server
# Caddy's default entrypoint will start the server based on the Caddyfile
# or by serving the current directory if no Caddyfile is found.