An nginx image for serving static websites, based on the
official nginx:stable image. It ships a hardened default server block and can
pull the site content at container start from a Git repository or a ZIP archive.
server_tokens off, hidden dotfiles
(except .well-known), and a security.txt redirect are preconfigured.SITE_REPO) or a ZIP archive (SITE_ARCHIVE) — no rebuild for a content change.try_files, 404.html
is wired to the error page, and assets/fonts get a 30-day cache lifetime.Serve content from a directory on the host:
docker run -d --name web \
-p 8080:80 \
-v /path/to/site:/usr/share/nginx/html:ro \
nginx-docker
Serve content cloned from a Git repository at startup:
docker run -d --name web \
-p 8080:80 \
-e SITE_REPO=https://git.example.com/user/site.git \
-e SITE_BRANCH=main \
nginx-docker
| Variable | Purpose |
|---|---|
SITE_REPO | Git URL cloned into /usr/share/nginx/html at startup. The .git directory is removed afterwards. |
SITE_BRANCH | Branch to check out after cloning. Only evaluated together with SITE_REPO. |
SITE_ARCHIVE | URL of a ZIP archive downloaded and unpacked into /usr/share/nginx/html. |
Both SITE_REPO and SITE_ARCHIVE replace the existing document root. If
neither is set, the entrypoint leaves the image content untouched — mount your
own volume in that case.
SITE_ARCHIVE is evaluated after SITE_REPO; setting both means the archive wins.
The default virtual host listens on port 80 (IPv4 and IPv6) and serves
/usr/share/nginx/html:
| Setting | Value |
|---|---|
| Index file | index.html |
| Error page | /404.html |
client_max_body_size | 16M |
| Asset/font caching | expires 30d |
| CORS on fonts and SVG | Access-Control-Allow-Origin: * |
Response headers set on every request:
X-XSS-Protection: 1; mode=blockX-Content-Type-Options: nosniffReferrer-Policy: no-referrer-when-downgradeContent-Security-Policy (self plus inline styles/scripts, frame-ancestors 'self')Permissions-Policy: interest-cohort=()Adjust these by mounting your own file over /etc/nginx/conf.d/default.conf, or
add further server blocks into /etc/nginx/conf.d/.
The image builds on the official nginx entrypoint, which runs everything in
/docker-entrypoint.d/ in lexicographic order. This image adds one script:
| Script | Purpose |
|---|---|
90-get-page.sh | Fetches the site content from SITE_REPO or SITE_ARCHIVE |
Because the prefix is 90, it runs after the upstream template and
configuration steps and just before nginx starts.
docker build -t nginx-docker .
The build runs apt-get upgrade on top of nginx:stable, so the weekly
rebuild picks up Debian security fixes even before the upstream image is
refreshed.
TLS termination is deliberately not part of this image — it is meant to run behind a reverse proxy or ingress controller that handles certificates.
This project uses pre-commit for style and quality checks, Conventional
Commits for the history, and Renovate for dependency updates.
The issue "Security Dashboard" lists the open CVE findings in the image built
here, for every environment that runs it, with checkboxes: open an issue,
ignore, snooze, request a check, start a rebuild. The weekly CVE scan writes
the rows; the workflow .forgejo/workflows/security-dashboard.yaml
(pyrox/actions/security-dashboard) executes a ticked box right away. It needs
the secrets SECURITY_DASHBOARD_TOKEN and SECURITY_DASHBOARD_KEY.
MIT — see LICENSE.
Content type
Image
Digest
sha256:1f30d9dc6…
Size
89.8 MB
Last updated
10 days ago
docker pull ricariel/nginx