This commit is contained in:
devad 2024-10-12 23:13:53 +08:00
parent d17090409e
commit 277ae3ea4c
1 changed files with 4 additions and 3 deletions

View File

@ -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