# syntax=docker/dockerfile:1 FROM golang:1.27-alpine AS build WORKDIR /src COPY go.mod go.sum ./ RUN go mod download COPY . . ARG VERSION=dev RUN go tool templ generate && \ CGO_ENABLED=0 GOOS=linux go build \ -trimpath \ -ldflags="-s -w -X main.version=${VERSION}" \ -o /foodster ./cmd/foodster # Nothing but the binary. modernc.org/sqlite is pure Go, so there is no libc # to carry along, and time/tzdata is compiled in because scratch has no # zoneinfo. FROM scratch COPY --from=build /foodster /foodster USER 65534:65534 EXPOSE 8080 ENTRYPOINT ["/foodster"]