Jelajahi Sumber

📦 build(docker): optimize Dockerfile apt source configuration

- 清除所有现有APT源配置文件,避免冲突
- 保持清华大学镜像源配置,确保软件包下载速度
- 移除多余空行,优化Dockerfile格式
yourname 1 bulan lalu
induk
melakukan
1424fee90e
1 mengubah file dengan 3 tambahan dan 5 penghapusan
  1. 3 5
      Dockerfile

+ 3 - 5
Dockerfile

@@ -1,17 +1,15 @@
-# 使用指定基础镜像
 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 && \
+# 清除所有现有的APT源配置
+RUN rm -rf /etc/apt/sources.list.d/* && \
+    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
-
 # 完全禁用APT的GPG验证
 RUN echo 'APT::Get::AllowUnauthenticated "true";' > /etc/apt/apt.conf.d/99allow-unauthenticated && \
     echo 'Acquire::AllowInsecureRepositories "true";' >> /etc/apt/apt.conf.d/99allow-unauthenticated && \
     echo 'Acquire::AllowDowngradeToInsecureRepositories "true";' >> /etc/apt/apt.conf.d/99allow-unauthenticated
-
 # 现在可以无验证更新和安装
 RUN apt update --fix-missing && \
     apt install -y curl wget