Bladeren bron

📦 build(docker): optimize Dockerfile apt configuration

- 添加APT配置文件跳过所有验证,简化安装流程
- 修改软件源配置,使用trusted=yes参数替代apt-key
- 调整软件安装顺序,先安装基础工具curl和wget
- 移除ca-certificates安装,减少不必要依赖
yourname 1 maand geleden
bovenliggende
commit
dcbe602fbd
1 gewijzigde bestanden met toevoegingen van 9 en 14 verwijderingen
  1. 9 14
      Dockerfile

+ 9 - 14
Dockerfile

@@ -1,23 +1,18 @@
 # 使用指定基础镜像
+# 使用指定基础镜像
 FROM docker.1ms.run/node:20.19.4-bookworm
 
-# 设置软件源为清华大学镜像源,并先安装必要的工具
-RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware" > /etc/apt/sources.list && \
-    echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware" >> /etc/apt/sources.list && \
-    echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware" >> /etc/apt/sources.list && \
-    echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware" >> /etc/apt/sources.list
-
-# 先更新并安装curl(不验证签名),然后添加GPG密钥
-RUN apt update --allow-unauthenticated --fix-missing && \
-    apt install -y curl wget gnupg
+# 直接修改apt配置,完全跳过所有验证
+RUN echo 'APT::Get::AllowUnauthenticated "true";' > /etc/apt/apt.conf.d/99unauthenticated
 
-# 添加Debian官方GPG密钥
-RUN wget -qO - https://ftp-master.debian.org/keys/archive-key-$(lsb_release -sr).asc | apt-key add - && \
-    wget -qO - https://ftp-master.debian.org/keys/archive-key-$(lsb_release -sr)-security.asc | apt-key add -
+# 设置软件源
+RUN echo "deb [trusted=yes] http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main" > /etc/apt/sources.list && \
+    echo "deb [trusted=yes] http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main" >> /etc/apt/sources.list && \
+    echo "deb [trusted=yes] http://mirrors.tuna.tsinghua.edu.cn/debian-security/ bookworm-security main" >> /etc/apt/sources.list
 
-# 现在可以正常更新和安装其他软件
+# 现在应该可以正常工作了
 RUN apt update --fix-missing && \
-    apt install -y ca-certificates
+    apt install -y curl wget
 
 # 安装 pnpm
 RUN npm install -g pnpm