Switch static server from nginx to static-web-server

Replace nginx:alpine-slim with the scratch-based static-web-server
image, reducing the final image size ~32MB -> ~23MB (28% smaller).

- Dockerfile: serve from static-web-server:2, copy site to /public
- sws.toml: mirror previous nginx behavior (compression, cache-control,
  SPA index fallback) plus security headers and /health endpoint
- Remove now-unused nginx.conf
This commit is contained in:
2026-07-25 01:04:17 +01:00
parent 0d425c0ed1
commit 898e3003a2
3 changed files with 48 additions and 74 deletions
+5 -4
View File
@@ -3,8 +3,9 @@ WORKDIR /tmp/hugo
COPY . .
RUN hugo --gc --minify
FROM nginx:alpine-slim
WORKDIR /usr/share/nginx/html
COPY nginx.conf /etc/nginx/nginx.conf
COPY --from=build /tmp/hugo/public .
FROM ghcr.io/static-web-server/static-web-server:2
COPY sws.toml /etc/sws.toml
COPY --from=build /tmp/hugo/public /public
ENV SERVER_CONFIG_FILE=/etc/sws.toml
EXPOSE 80/tcp
CMD ["--config-file", "/etc/sws.toml"]