From 9e5aaa52cb82a2acc9c254c933475bddf99f3998 Mon Sep 17 00:00:00 2001 From: duzhuoshanwai <65448395+duzhuoshanwai@users.noreply.github.com> Date: Sun, 27 Oct 2024 00:33:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BADockerfile=E4=B8=AD=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=9B=BF=E6=8D=A2alpine=E9=95=9C=E5=83=8F=E6=BA=90=E5=91=BD?= =?UTF-8?q?=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 解决神奇的网络问题 Step 8/14 : RUN apk --no-cache add ca-certificates ---> Running in a525d7759627 fetch https://dl-cdn.alpinelinux.org/alpine/v3.20/main/x86_64/APKINDEX.tar.gz WARNING: fetching https://dl-cdn.alpinelinux.org/alpine/v3.20/main: temporary error (try again later) fetch https://dl-cdn.alpinelinux.org/alpine/v3.20/community/x86_64/APKINDEX.tar.gz WARNING: fetching https://dl-cdn.alpinelinux.org/alpine/v3.20/community: temporary error (try again later) ERROR: unable to select packages: ca-certificates (no such package): required by: world[ca-certificates] The command '/bin/sh -c apk --no-cache add ca-certificates' returned a non-zero code: 1 --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index ba8bc46..5b9b3bc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,8 @@ RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o override FROM alpine:latest +RUN sed -i 's#https\?://dl-cdn.alpinelinux.org/alpine#https://mirrors.tuna.tsinghua.edu.cn/alpine#g' /etc/apk/repositories + RUN apk --no-cache add ca-certificates COPY --from=builder /app/override /usr/local/bin/