FROM golang:1.26-alpine AS build WORKDIR /src # Fetch internal git-hosted Go modules (cad-atlas now depends on # git.d-ma.be/mathias/cad — cad-atlas#11, reusing cad#14's cad-stuck query # logic rather than duplicating the taxonomy) without going through # proxy.golang.org. Gitea returns http:// in its go-import meta tag, so # rewrite to https and bypass the module proxy + sumdb (mirrors mathias/cad's # own Dockerfile — same trick, same reason). RUN apk add --no-cache git && \ git config --global url."https://git.d-ma.be/".insteadOf "http://git.d-ma.be/" ENV GOPRIVATE=git.d-ma.be ENV GOPROXY=direct ENV GOSUMDB=off RUN go install github.com/a-h/templ/cmd/templ@latest COPY go.mod go.sum ./ RUN go mod download COPY . . ARG VERSION=dev RUN templ generate && CGO_ENABLED=0 go build -trimpath \ -ldflags="-s -w -X git.d-ma.be/mathias/cad-atlas/internal/version.Value=${VERSION}" \ -o /out/app ./cmd/cad-atlas FROM gcr.io/distroless/static-debian12:nonroot COPY --from=build /out/app /app USER nonroot:nonroot EXPOSE 8080 ENTRYPOINT ["/app"]