We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 066800b commit cbbc005Copy full SHA for cbbc005
Dockerfile
@@ -20,7 +20,11 @@ RUN npm run build
20
# ============================================
21
# Stage 2: Backend Builder
22
23
-FROM golang:1.23-alpine AS backend-builder
+FROM --platform=$BUILDPLATFORM golang:1.23-alpine AS backend-builder
24
+
25
+# 接收目标平台参数
26
+ARG TARGETOS
27
+ARG TARGETARCH
28
29
WORKDIR /build
30
@@ -35,8 +39,8 @@ RUN go mod download
35
39
COPY . .
36
40
37
41
# Build binary with optimizations
38
-# CGO_ENABLED=0 for pure Go SQLite (modernc.org/sqlite)
-RUN CGO_ENABLED=0 GOOS=linux go build \
42
+# 使用 Go 原生交叉编译,而非 QEMU 模拟
43
+RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build \
44
-trimpath \
45
-ldflags="-s -w" \
46
-o bitwarden-backup \
0 commit comments