chore(build): 镜像内构建 hfb-rebate-backfill 以便生产执行返利补发

补发脚本需要在生产镜像里可直接执行,与 hfb-storage-migrate 保持同一构建/拷贝方式。
This commit is contained in:
yml2213
2026-10-13 15:14:07 +08:00
parent ead58417e0
commit 0082a60b46
+5
View File
@@ -19,6 +19,10 @@ RUN --mount=type=cache,target=/go/pkg/mod \
RUN --mount=type=cache,target=/go/pkg/mod \ RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \ --mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 GOOS=linux go build -o /out/hfb-storage-migrate ./cmd/storage-migrate CGO_ENABLED=0 GOOS=linux go build -o /out/hfb-storage-migrate ./cmd/storage-migrate
# 一次性运维脚本:线下提号邀请返利补发(默认预演,-apply 才写库)
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 GOOS=linux go build -o /out/hfb-rebate-backfill ./cmd/rebate-backfill
FROM alpine:3.22 FROM alpine:3.22
@@ -34,6 +38,7 @@ RUN sed -i 's#https\?://dl-cdn.alpinelinux.org/alpine#https://mirrors.aliyun.com
&& chown app:app /app/logs && chown app:app /app/logs
COPY --from=build /out/hfb-api /app/hfb-api COPY --from=build /out/hfb-api /app/hfb-api
COPY --from=build /out/hfb-storage-migrate /app/hfb-storage-migrate COPY --from=build /out/hfb-storage-migrate /app/hfb-storage-migrate
COPY --from=build /out/hfb-rebate-backfill /app/hfb-rebate-backfill
COPY --from=build /go/bin/goose /app/goose COPY --from=build /go/bin/goose /app/goose
COPY --from=build /src/migrations /app/migrations COPY --from=build /src/migrations /app/migrations
USER app:app USER app:app