2023-10-11 09:59:20 +00:00
|
|
|
# syntax=docker/dockerfile:1
|
|
|
|
|
2024-06-30 15:46:13 +00:00
|
|
|
ARG GO_VERSION=1.22.4
|
2024-06-30 15:59:12 +00:00
|
|
|
ARG ALPINE_VERSION=3.20
|
2023-10-11 09:59:20 +00:00
|
|
|
|
|
|
|
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS base
|
|
|
|
RUN apk add --no-cache git
|
|
|
|
|
|
|
|
FROM base AS hugo
|
|
|
|
ARG HUGO_VERSION=0.119.0
|
|
|
|
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=. \
|
2024-01-09 19:10:18 +00:00
|
|
|
hugo --gc --minify --destination /out
|
2023-10-11 09:59:20 +00:00
|
|
|
|
|
|
|
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 /
|
2023-10-12 07:32:55 +00:00
|
|
|
|
|
|
|
FROM wjdp/htmltest:v0.17.0 AS test
|
2024-01-09 19:10:18 +00:00
|
|
|
# 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 .
|
2023-10-12 07:32:55 +00:00
|
|
|
WORKDIR /test
|
|
|
|
ADD docs/.htmltest.yml .htmltest.yml
|
|
|
|
RUN --mount=type=cache,target=tmp/.htmltest \
|
|
|
|
htmltest
|