From 277ae3ea4c8efc40d1576c08884fe455536607f2 Mon Sep 17 00:00:00 2001 From: devad Date: Sat, 12 Oct 2024 23:13:53 +0800 Subject: [PATCH] fix --- Dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2eeb91df..94b01fe3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,11 +6,12 @@ COPY . . ENV GO111MODULE=on GOPROXY=https://goproxy.cn,direct RUN go mod download +ARG TARGETOS +ARG TARGETARCH # 使用 GOOS 和 GOARCH 环境变量来构建不同架构的二进制文件 RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags="-w -s" -o pcm-core-api - -FROM alpine:latest +FROM --platform=$TARGETPLATFORM alpine:latest WORKDIR /app #修改alpine源为上海交通大学 @@ -19,7 +20,7 @@ RUN apk add --no-cache ca-certificates && update-ca-certificates && \ rm -rf /var/cache/apk/* COPY --from=builder /app/pcm-core-api . -COPY etc/pcm.yaml . +COPY --from=builder /app/etc/pcm.yaml . ENV TZ=Asia/Shanghai