Files
wonder 846288731f
Deploy PR-Helper / deploy (push) Successful in 3m28s
perf: add BuildKit cache mounts to speed up Go build in Docker
Mount persistent cache for go build and module directories so
subsequent builds only recompile changed packages.
2026-06-21 14:20:34 +08:00

23 lines
591 B
Docker

# syntax=docker/dockerfile:1
# Build stage
FROM golang:1.25-alpine AS builder
WORKDIR /app
COPY go.mod go.sum ./
ENV GOPROXY=https://goproxy.cn,direct
RUN go mod download
COPY . .
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
CGO_ENABLED=0 go build -o pr-helper .
# Runtime stage
FROM alpine:3.20
RUN apk add --no-cache ca-certificates tzdata
WORKDIR /app
COPY --from=builder /app/pr-helper .
COPY --from=builder /app/templates ./templates
COPY --from=builder /app/static ./static
VOLUME ["/app/data"]
EXPOSE 8080
CMD ["./pr-helper"]