发版注入版本与构建时间,升级 oci-go-sdk 65.120.0
CI / test (push) Successful in 43s
Release / release (push) Successful in 52s

This commit is contained in:
Wang Defa
2026-07-09 19:29:45 +08:00
parent 3e0389c1e9
commit 4af6a0ca92
7 changed files with 36 additions and 11 deletions
+5 -2
View File
@@ -13,9 +13,12 @@ WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . ./
ARG TARGETOS TARGETARCH
# VERSION/BUILD_TIME 由 release 流程 --build-arg 传入,注入「设置·关于」页;本地构建缺省 dev
ARG TARGETOS TARGETARCH VERSION=dev BUILD_TIME=""
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH \
go build -trimpath -ldflags "-s -w" -o /oci-portal-server ./cmd/server
go build -trimpath \
-ldflags "-s -w -X oci-portal/internal/api.buildVersion=${VERSION} -X oci-portal/internal/api.buildTime=${BUILD_TIME}" \
-o /oci-portal-server ./cmd/server
# artifact: 仅承载二进制,供 buildx --output type=local 导出(release 流程用)
FROM scratch AS artifact