distribution/dockerfiles/docs.Dockerfile
Milos Gajdos f08898c2c3
update: bump Go version
It'd appear 1.20.10 is triggering some scanner alerts.
Though these are not critical, it costs us very little effort to bump
the runtime one minor version higher.

Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
2023-12-01 08:33:35 +00:00

36 lines
870 B
Docker

# syntax=docker/dockerfile:1
ARG GO_VERSION=1.20.11
ARG ALPINE_VERSION=3.18
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
ARG DOCS_BASEURL=/
RUN --mount=type=bind,rw,source=docs,target=. \
hugo --gc --minify --destination /out -b $DOCS_BASEURL
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
WORKDIR /test
COPY --from=build /out ./public
ADD docs/.htmltest.yml .htmltest.yml
RUN --mount=type=cache,target=tmp/.htmltest \
htmltest