Rewrite: modernize nginx config, fix healthcheck, multi-arch CI #5

Closed
ai-bot wants to merge 1 commit from (deleted):rewrite/modernize into main
First-time contributor

Summary

This PR modernises the image, fixes a real bug in the healthcheck, and ships a few quality-of-life improvements.

Bug fix

  • HEALTHCHECK was broken. nginx:alpine does not include curl, so every container would have been reported unhealthy regardless of nginx state. Switched to busybox wget --spider, which is already in the image (no extra layer).

Dockerfile

  • Pinned base to nginx:1.27-alpine (current stable major, renovate will track).
  • OCI image labels (org.opencontainers.image.*) so registries and tools can render metadata.
  • VOLUME ["/assets", "/log"] JSON form (lint-cleaner).
  • Dropped the no-op rm -rf /var/cache/apk/* (no apk add runs in this build).
  • Tightened ownership: pre-create /log/access.log and /log/error.log and chown them to the nginx user so the running container can actually write to them when /log is a fresh volume mount.

conf/nginx.conf

  • worker_processes auto; (was hardcoded to 4).
  • worker_connections 1024 + multi_accept on.
  • server_tokens off; so the nginx version is not leaked in Server: headers or error pages.
  • Modern gzip block (gzip_vary, gzip_proxied, gzip_comp_level 6, gzip_min_length 1024, explicit gzip_types).
  • Removed obsolete gzip_disable "msie6";.

conf/default

  • listen 80 default_server; listen [::]:80 default_server; server_name _; (explicit defaults + IPv6).
  • charset utf-8; so directory listings render correctly.
  • autoindex_exact_size off; (human-readable KB/MB/GB) and autoindex_localtime on;.
  • try_files $uri $uri/ =404; so missing paths don't fall back to the autoindex of /.
  • Blocked a few sensitive extensions (.htaccess, .htpasswd, .env, .git) with deny all; return 404;.

CI / repo hygiene

  • .woodpecker.yml now builds for both linux/amd64 and linux/arm64.
  • .gitignore covers JetBrains, macOS and Windows noise in addition to VS Code.
  • renovate.json extends config:recommended and tells renovate to scan the Dockerfile.

Docs

  • README.md now documents the autoindex options, the healthcheck and how to override the server config.

Verification

Built and ran locally with docker build . && docker run -p 8081:80 -v /tmp/test-assets:/assets:ro docker-nginx-autoindex:test:

  • HTTP 200 on / and /subdir/
  • Autoindex renders with human-readable sizes and local timestamps
  • docker inspect reports Health.Status: healthy
  • nginx -t passes
  • Final image size: 73.6 MB

🤖 This pull request was prepared by an AI agent on behalf of the repository owner.

## Summary This PR modernises the image, fixes a real bug in the healthcheck, and ships a few quality-of-life improvements. ### Bug fix - **`HEALTHCHECK` was broken.** `nginx:alpine` does not include `curl`, so every container would have been reported `unhealthy` regardless of nginx state. Switched to busybox `wget --spider`, which is already in the image (no extra layer). ### Dockerfile - Pinned base to `nginx:1.27-alpine` (current stable major, renovate will track). - OCI image labels (`org.opencontainers.image.*`) so registries and tools can render metadata. - `VOLUME ["/assets", "/log"]` JSON form (lint-cleaner). - Dropped the no-op `rm -rf /var/cache/apk/*` (no `apk add` runs in this build). - Tightened ownership: pre-create `/log/access.log` and `/log/error.log` and `chown` them to the `nginx` user so the running container can actually write to them when `/log` is a fresh volume mount. ### `conf/nginx.conf` - `worker_processes auto;` (was hardcoded to `4`). - `worker_connections 1024` + `multi_accept on`. - `server_tokens off;` so the nginx version is not leaked in `Server:` headers or error pages. - Modern gzip block (`gzip_vary`, `gzip_proxied`, `gzip_comp_level 6`, `gzip_min_length 1024`, explicit `gzip_types`). - Removed obsolete `gzip_disable "msie6";`. ### `conf/default` - `listen 80 default_server; listen [::]:80 default_server; server_name _;` (explicit defaults + IPv6). - `charset utf-8;` so directory listings render correctly. - `autoindex_exact_size off;` (human-readable KB/MB/GB) and `autoindex_localtime on;`. - `try_files $uri $uri/ =404;` so missing paths don't fall back to the autoindex of `/`. - Blocked a few sensitive extensions (`.htaccess`, `.htpasswd`, `.env`, `.git`) with `deny all; return 404;`. ### CI / repo hygiene - `.woodpecker.yml` now builds for both `linux/amd64` and `linux/arm64`. - `.gitignore` covers JetBrains, macOS and Windows noise in addition to VS Code. - `renovate.json` extends `config:recommended` and tells renovate to scan the `Dockerfile`. ### Docs - `README.md` now documents the autoindex options, the healthcheck and how to override the server config. ## Verification Built and ran locally with `docker build . && docker run -p 8081:80 -v /tmp/test-assets:/assets:ro docker-nginx-autoindex:test`: - HTTP 200 on `/` and `/subdir/` - Autoindex renders with human-readable sizes and local timestamps - `docker inspect` reports `Health.Status: healthy` - `nginx -t` passes - Final image size: 73.6 MB --- 🤖 This pull request was prepared by an AI agent on behalf of the repository owner.
Dockerfile:
- Fix healthcheck (busybox wget instead of missing curl)
- Switch to nginx 1.27-alpine for a pinned stable base
- Add OCI image labels
- Use the JSON-array VOLUME form
- Drop no-op apk cache cleanup; tighten log-file ownership

conf/nginx.conf:
- worker_processes auto; and worker_connections 1024
- multi_accept on
- server_tokens off
- Modern gzip settings (vary, proxied, comp_level, min_length, types)
- Drop obsolete gzip_disable 'msie6'

conf/default:
- Listen on default_server (IPv4 + IPv6) with server_name _
- charset utf-8
- autoindex_exact_size off (human-readable), autoindex_localtime on,
  autoindex_format html
- try_files fallback for proper 404s
- Deny sensitive file extensions

.woodpecker.yml:
- Build for linux/amd64 and linux/arm64

README.md:
- Document features, volumes, autoindex options, healthcheck

.gitignore:
- Cover JetBrains, macOS and Windows noise

renovate.json:
- Extend config:recommended and enable Dockerfile matching

Co-authored-by: openhands <openhands@all-hands.dev>
ai-bot force-pushed rewrite/modernize from cf72a45751 to 441a11782e 2026-07-16 12:50:17 +02:00 Compare
phil closed this pull request 2026-07-19 21:26:11 +02:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
phil/docker-nginx-autoindex!5
No description provided.