f4e1ecc5f1
- artifact_fetch.py: 新增 dingtalk dws 取件器(adoc→doc export、axls→sheet 转换、其余→drive 直下),
ARTIFACT_DINGTALK_FETCHER=dws|auto|legacy 三级开关,auto 仅对可重试错误回落老路径;
平台侧判定(pick_suffix/SLIDES/magic/大小上限/sha256/spool/空壳检查)全部保留;
结果 JSON 字段不变(Go runner 用 DisallowUnknownFields 解析 stdout),取件器来源只写 stderr。
- axls_to_xlsx.py: 纯标准库 axls→xlsx(文本写入 sharedStrings 以通过空壳判定)。
- dws_error_map.py: dws 错误→平台 {ok,code,retryable,missing};未分类错误默认不重试。
- Dockerfile: alpine 增加 gcompat/libc6-compat;dws v1.0.63 固定版本+sha256 校验;构建期 dws version 自检。
- compose.yaml: worker 增加 dws 环境与凭据挂载(DWS_HOME 方案,XDG_DATA_HOME 不被 dws 识别)。
- 测试: artifact_fetch_test 新增 11 项(路由/回落语义/契约字段锁定);dws_error_map 17 断言。
- 实测: 真容器(--read-only --tmpfs --user 1000:1000) 端到端 adoc/axls/pdf 3/3 成功,docx sha 与平台基准一致。
38 lines
1.9 KiB
Docker
38 lines
1.9 KiB
Docker
FROM golang:1.26-alpine AS build
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY cmd ./cmd
|
|
COPY internal ./internal
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -o /out/api ./cmd/api \
|
|
&& CGO_ENABLED=0 GOOS=linux go build -trimpath -o /out/worker ./cmd/worker \
|
|
&& CGO_ENABLED=0 GOOS=linux go build -trimpath -o /out/release-worker ./cmd/release-worker \
|
|
&& CGO_ENABLED=0 GOOS=linux go build -trimpath -o /out/test-publication-seed ./cmd/test-publication-seed \
|
|
&& CGO_ENABLED=0 GOOS=linux go build -trimpath -o /out/test-weknora-e2e-report ./cmd/test-weknora-e2e-report \
|
|
&& CGO_ENABLED=0 GOOS=linux go build -trimpath -o /out/test-weknora-probe ./cmd/test-weknora-probe
|
|
|
|
FROM alpine:3.22
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
RUN apk add --no-cache ca-certificates python3 postgresql-client curl gcompat libc6-compat \
|
|
&& addgroup -g 65532 governance \
|
|
&& adduser -D -H -u 65532 -G governance governance
|
|
# dws (DingTalk Workspace CLI) v1.0.63:版本+校验和固定(禁用 dws upgrade)。
|
|
# 官方产物是动态链接 glibc 的二进制,alpine(musl) 靠 gcompat/libc6-compat 运行,
|
|
# 已验证端到端取件并与 glibc 原生环境字节一致。构建期 `dws version` 即自检。
|
|
ARG DWS_VERSION=v1.0.63
|
|
ARG DWS_SHA256=78cab668bf671c17128ac55347627fb28f80c15b9c30c5f86e32e2b5ee6e34bc
|
|
RUN set -eux; \
|
|
curl -fsSL -o /tmp/dws.tgz \
|
|
"https://github.com/DingTalk-Real-AI/dingtalk-workspace-cli/releases/download/${DWS_VERSION}/dws-linux-amd64.tar.gz"; \
|
|
echo "${DWS_SHA256} /tmp/dws.tgz" | sha256sum -c -; \
|
|
tar -xzf /tmp/dws.tgz -C /tmp ./dws; \
|
|
install -m 0755 /tmp/dws /usr/local/bin/dws; \
|
|
rm -rf /tmp/dws.tgz /tmp/dws; \
|
|
dws version
|
|
WORKDIR /app
|
|
COPY --from=build /out/ /app/
|
|
COPY scripts/source_catalog_import.py scripts/live_catalog_refresh.py scripts/artifact_fetch.py \
|
|
scripts/axls_to_xlsx.py scripts/dws_error_map.py /app/scripts/
|
|
USER 65532:65532
|
|
CMD ["/app/api"]
|