8258160f95
- Use github.actor instead of gitea.actor - Add act-latest container for Gitea Actions - Simplify Dockerfile to use alpine - Remove CGO dependencies - Fix frontend build path
32 lines
554 B
Docker
32 lines
554 B
Docker
# 构建阶段
|
|
FROM golang:1.22-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# 复制源代码
|
|
COPY . .
|
|
|
|
# 构建
|
|
RUN go mod download || true
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o anticaptcha ./cmd/server
|
|
|
|
# 运行阶段
|
|
FROM alpine:3.20
|
|
|
|
RUN apk add --no-cache ca-certificates tzdata
|
|
|
|
WORKDIR /app
|
|
|
|
# 复制二进制文件和前端
|
|
COPY --from=builder /app/anticaptcha .
|
|
COPY --from=builder /app/web/dist ./web/dist
|
|
|
|
# 创建目录
|
|
RUN mkdir -p /app/data /app/models
|
|
|
|
ENV GIN_MODE=release
|
|
ENV TZ=Asia/Shanghai
|
|
|
|
EXPOSE 6688
|
|
|
|
CMD ["./anticaptcha"] |