| |
| FROM golang:1.25.3-alpine AS builder |
|
|
| WORKDIR /build |
|
|
| |
| COPY go.mod go.sum ./ |
| RUN go mod download |
|
|
| |
| COPY . . |
|
|
| |
| RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o patbin . |
|
|
| |
| FROM alpine:3.19 |
|
|
| WORKDIR /app |
|
|
| |
| RUN apk --no-cache add ca-certificates tzdata |
|
|
| |
| RUN adduser -D -g '' appuser |
|
|
| |
| COPY --from=builder /build/patbin . |
|
|
| |
| COPY --from=builder /build/static ./static |
| COPY --from=builder /build/templates ./templates |
|
|
| |
| RUN mkdir -p /app/data && chown -R appuser:appuser /app |
|
|
| |
| USER appuser |
|
|
| |
| ENV PORT=7860 |
| ENV DB_PATH=/app/data/patbin.db |
| ENV GIN_MODE=release |
|
|
| |
| EXPOSE 7860 |
|
|
| |
| HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ |
| CMD wget --no-verbose --tries=1 --spider http://localhost:7860/ || exit 1 |
|
|
| |
| CMD ["./patbin"] |
|
|