27 lines
839 B
Docker
Executable File
27 lines
839 B
Docker
Executable File
# 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.
|
|
FROM --platform=$BUILDPLATFORM ghcr.io/hugomods/hugo:0.157.0 AS build
|
|
WORKDIR /tmp/hugo
|
|
|
|
COPY go.mod ./
|
|
RUN hugo mod get
|
|
|
|
COPY archetypes ./archetypes
|
|
COPY assets ./assets
|
|
COPY content ./content
|
|
COPY static ./static
|
|
COPY themes ./themes
|
|
COPY hugo.* ./
|
|
|
|
RUN hugo --gc --minify
|
|
|
|
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"]
|