524c404194
Features: - Go + CGO ONNX/OpenCV wrapper for high performance - SQLite (default) / MySQL database support - Optional Redis caching - JWT authentication system - Multiple captcha recognition APIs: - OCR text recognition - Slider captcha matching - Image similarity comparison - Rotation captcha detection - Object detection - React frontend with install wizard - Docker and docker-compose support - Gitea CI/CD pipeline Project structure: - cmd/server: Main entry point - internal/: Core business logic - pkg/onnx: ONNX Runtime CGO wrapper - pkg/opencv: OpenCV CGO wrapper - web/: React frontend - deploy/: Deployment configs - scripts/: Utility scripts
40 lines
724 B
Docker
40 lines
724 B
Docker
# 构建阶段
|
|
FROM golang:1.22-alpine AS builder
|
|
|
|
# 安装构建依赖
|
|
RUN apk add --no-cache git gcc g++ make opencv-dev onnxruntime-dev
|
|
|
|
WORKDIR /app
|
|
|
|
# 复制 Go 模块文件
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
# 复制源代码
|
|
COPY . .
|
|
|
|
# 构建
|
|
RUN CGO_ENABLED=1 go build -o anticaptcha ./cmd/server
|
|
|
|
# 运行阶段
|
|
FROM alpine:3.20
|
|
|
|
# 安装运行时依赖
|
|
RUN apk add --no-cache ca-certificates tzdata opencv onnxruntime
|
|
|
|
WORKDIR /app
|
|
|
|
# 复制二进制文件
|
|
COPY --from=builder /app/anticaptcha .
|
|
COPY --from=builder /app/models ./models
|
|
COPY --from=builder /app/web/dist ./web/dist
|
|
|
|
# 创建数据目录
|
|
RUN mkdir -p /app/data
|
|
|
|
ENV GIN_MODE=release
|
|
ENV TZ=Asia/Shanghai
|
|
|
|
EXPOSE 6688
|
|
|
|
CMD ["./anticaptcha"] |