fix: simplify CI/CD and Dockerfile
Build and Deploy / build (push) Failing after 52s
Build and Deploy / deploy (push) Has been skipped

- 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
This commit is contained in:
2026-07-16 10:33:23 +00:00
parent a79e8fb853
commit 8258160f95
2 changed files with 17 additions and 47 deletions
+5 -24
View File
@@ -1,38 +1,19 @@
# 构建阶段
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/*
FROM golang:1.22-alpine AS builder
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
FROM alpine:3.20
# 安装运行时依赖
RUN apt-get update && apt-get install -y \
ca-certificates \
tzdata \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
RUN apk add --no-cache ca-certificates tzdata
WORKDIR /app
@@ -40,7 +21,7 @@ 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