2026-06-21 14:20:34 +08:00
|
|
|
# syntax=docker/dockerfile:1
|
2026-06-20 00:06:10 +08:00
|
|
|
# Build stage
|
2026-06-20 22:57:08 +08:00
|
|
|
FROM golang:1.25-alpine AS builder
|
2026-06-20 00:06:10 +08:00
|
|
|
WORKDIR /app
|
|
|
|
|
COPY go.mod go.sum ./
|
2026-06-20 22:58:41 +08:00
|
|
|
ENV GOPROXY=https://goproxy.cn,direct
|
2026-06-20 00:06:10 +08:00
|
|
|
RUN go mod download
|
|
|
|
|
COPY . .
|
2026-06-21 14:20:34 +08:00
|
|
|
RUN --mount=type=cache,target=/root/.cache/go-build \
|
|
|
|
|
--mount=type=cache,target=/go/pkg/mod \
|
|
|
|
|
CGO_ENABLED=0 go build -o pr-helper .
|
2026-06-20 00:06:10 +08:00
|
|
|
|
|
|
|
|
# Runtime stage
|
|
|
|
|
FROM alpine:3.20
|
2026-06-20 22:40:46 +08:00
|
|
|
RUN apk add --no-cache ca-certificates tzdata
|
2026-06-20 00:06:10 +08:00
|
|
|
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"]
|