# Supermarket's web app. Built locally by install.sh / update.sh through # compose.yaml; nothing is pulled from a registry but the base images. FROM golang:1.26-alpine AS build WORKDIR /src COPY go.mod go.sum ./ RUN go mod download COPY . . ARG VERSION=dev RUN CGO_ENABLED=0 go build -trimpath -ldflags "-s -w -X 'main.version=${VERSION}'" \ -o /out/supermarket ./cmd/supermarket # Hugo, for the SEO and Sites modules, which build Hugo repositories to check # a change and to preview a branch. Alpine's package lags years behind, and # sites use newer template functions (hugo.Data needs 0.156+), so a pinned # release is built from source; Go checks it against its checksum database. # This is the standard edition: sites that need Sass (extended) won't build. FROM golang:1.27-alpine AS hugo ARG HUGO_VERSION=0.170.1 RUN CGO_ENABLED=0 go install -trimpath -ldflags "-s -w" github.com/gohugoio/hugo@v${HUGO_VERSION} FROM alpine:3.22 # git: for the SEO and Sites modules, which change Hugo repositories. RUN apk add --no-cache ca-certificates tzdata git COPY --from=hugo /go/bin/hugo /usr/local/bin/hugo COPY --from=build /out/supermarket /usr/local/bin/supermarket LABEL org.opencontainers.image.title="supermarket" ENV SUPERMARKET_DATA=/data EXPOSE 8080 HEALTHCHECK --interval=30s --timeout=5s --start-period=10s \ CMD wget -q -O /dev/null http://127.0.0.1:8080/healthz || exit 1 ENTRYPOINT ["/usr/local/bin/supermarket"]