2026-08-03 15:40:22 +00:00
|
|
|
# syntax=docker/dockerfile:1
|
|
|
|
|
# Pin the build stage to the native build platform so Hugo runs once (never
|
|
|
|
|
# under QEMU emulation). Hugo output is static HTML — identical across arches —
|
|
|
|
|
# so there's no reason to run it per target arch. The runtime stage below stays
|
|
|
|
|
# on TARGETPLATFORM, so multi-arch (amd64 + arm64) runtime images are preserved.
|
2026-08-23 18:15:52 +00:00
|
|
|
FROM --platform=$BUILDPLATFORM ghcr.io/hugomods/hugo:0.165.0 AS build
|
2024-11-16 20:03:11 +00:00
|
|
|
WORKDIR /tmp/hugo
|
2026-08-22 01:21:32 +00:00
|
|
|
|
2026-08-23 18:15:52 +00:00
|
|
|
COPY go.mod go.sum ./
|
|
|
|
|
COPY config ./config
|
|
|
|
|
RUN hugo mod graph
|
2026-08-22 01:21:32 +00:00
|
|
|
|
2026-08-23 18:15:52 +00:00
|
|
|
COPY assets ./assets
|
|
|
|
|
COPY content ./content
|
|
|
|
|
COPY layouts ./layouts
|
|
|
|
|
COPY static ./static
|
2024-11-16 20:21:18 +00:00
|
|
|
RUN hugo --gc --minify
|
2024-11-16 20:03:11 +00:00
|
|
|
|
2026-07-25 01:04:17 +01:00
|
|
|
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
|
2024-11-16 20:03:11 +00:00
|
|
|
EXPOSE 80/tcp
|
2026-07-25 01:04:17 +01:00
|
|
|
CMD ["--config-file", "/etc/sws.toml"]
|