Files
AntiCaptcha/Dockerfile
T
admin 731e00855b
Build and Deploy / build (push) Failing after 3s
Build and Deploy / deploy (push) Has been skipped
fix: CI/CD build errors
- Simplified go.mod with all dependencies
- Fixed generateRandomSecret function
- Updated Dockerfile to use debian bookworm
- Simplified CI workflow to single job
- Fixed Gitea Actions syntax (github.ref)
2026-07-16 09:23:24 +00:00

51 lines
933 B
Docker

# 构建阶段
FROM golang:1.22-bookworm AS builder
# 安装构建依赖
RUN apt-get update && apt-get install -y \
git \
gcc \
g++ \
make \
libopencv-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# 复制 Go 模块文件
COPY go.mod ./
# 复制源代码
COPY . .
# 下载依赖
RUN go mod download || true
# 构建(纯 Go 版本,暂不启用 CGO)
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o anticaptcha ./cmd/server
# 运行阶段
FROM debian:bookworm-slim
# 安装运行时依赖
RUN apt-get update && apt-get install -y \
ca-certificates \
tzdata \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
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"]