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:
+5
-4
@@ -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"]
|
||||
|
||||
Reference in New Issue
Block a user