Parcourir la source

📦 build(docker): optimize Dockerfile configuration

- update Debian software sources to Tsinghua University mirror for faster downloads
- enhance APT unauthenticated configuration with more comprehensive settings
- improve PostgreSQL repository configuration comments for clarity
yourname il y a 1 mois
Parent
commit
0db989ebb8
1 fichiers modifiés avec 11 ajouts et 9 suppressions
  1. 11 9
      Dockerfile

+ 11 - 9
Dockerfile

@@ -1,16 +1,18 @@
 # 使用指定基础镜像
-# 使用指定基础镜像
 FROM docker.1ms.run/node:20.19.4-bookworm
 
-# 直接修改apt配置,完全跳过所有验证
-RUN echo 'APT::Get::AllowUnauthenticated "true";' > /etc/apt/apt.conf.d/99unauthenticated
+# 设置软件源为清华大学镜像源
+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
 
-# 设置软件源
-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
+# 完全禁用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
 
@@ -21,7 +23,7 @@ RUN npm install -g pnpm
 RUN pnpm config set registry https://registry.npmmirror.com/
 RUN pnpm config set @jsr:registry https://npm.jsr.io
 
-# 添加PostgreSQL 17的官方仓库
+# 添加PostgreSQL 17的官方仓库(同样禁用验证)
 RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \
     echo "deb http://apt.postgresql.org/pub/repos/apt/ bookworm-pgdg main" > /etc/apt/sources.list.d/pgdg.list