Files
distribution/dockerfiles/docs.Dockerfile
Sebastiaan van Stijn 60d2cd5c44 update to go1.25.7, alpine 3.23
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-02-12 04:22:51 -08:00

46 lines
1.4 KiB
Docker

# syntax=docker/dockerfile:1
# GO_VERSION sets the version of the golang base image to use.
# It must be a supported tag in the docker.io/library/golang image repository.
ARG GO_VERSION=1.25.7
# ALPINE_VERSION sets the version of the alpine base image to use, including for the golang image.
# It must be a supported tag in the docker.io/library/alpine image repository
# that's also available as alpine image variant for the Golang version used.
ARG ALPINE_VERSION=3.23
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS base
RUN apk add --no-cache git
FROM base AS hugo
ARG HUGO_VERSION=0.136.5
RUN --mount=type=cache,target=/go/mod/pkg \
go install github.com/gohugoio/hugo@v${HUGO_VERSION}
FROM base AS build-base
COPY --from=hugo $GOPATH/bin/hugo /bin/hugo
WORKDIR /src
FROM build-base AS build
RUN --mount=type=bind,rw,source=docs,target=. \
hugo --gc --minify --destination /out
FROM build-base AS server
COPY docs .
ENTRYPOINT [ "hugo", "server", "--bind", "0.0.0.0" ]
EXPOSE 1313
FROM scratch AS out
COPY --from=build /out /
FROM wjdp/htmltest:v0.17.0 AS test
# Copy the site to a public/distribution subdirectory
# This is a workaround for a limitation in htmltest, see:
# https://github.com/wjdp/htmltest/issues/45
WORKDIR /test/public/distribution
COPY --from=build /out .
WORKDIR /test
ADD docs/.htmltest.yml .htmltest.yml
RUN --mount=type=cache,target=tmp/.htmltest \
htmltest