feat: 添加 Docker 部署配置
This commit is contained in:
+20
@@ -0,0 +1,20 @@
|
||||
# Build stage
|
||||
FROM golang:1.24-alpine AS builder
|
||||
RUN apk add --no-cache gcc musl-dev
|
||||
WORKDIR /app
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
COPY . .
|
||||
RUN CGO_ENABLED=1 go build -o pr-helper .
|
||||
|
||||
# Runtime stage
|
||||
FROM alpine:3.20
|
||||
RUN apk add --no-cache ca-certificates chromium
|
||||
ENV CHROME_BIN=/usr/bin/chromium-browser
|
||||
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"]
|
||||
@@ -0,0 +1,13 @@
|
||||
services:
|
||||
pr-helper:
|
||||
build: .
|
||||
ports:
|
||||
- "8080:8080"
|
||||
volumes:
|
||||
- pr-helper-data:/app/data
|
||||
environment:
|
||||
- GIN_MODE=release
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
pr-helper-data:
|
||||
Reference in New Issue
Block a user