From f1ead3ae6cea97978c6cd8caa745943f82e93dec Mon Sep 17 00:00:00 2001 From: fly6516 Date: Tue, 4 Mar 2025 14:15:27 +0800 Subject: [PATCH] feat: update Dockerfile.cn for avoid docker pull error --- Dockerfile.cn | 15 +++++++++------ docker/lsp/clangd/Dockerfile.cn | 4 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Dockerfile.cn b/Dockerfile.cn index 9e15110..17907a7 100644 --- a/Dockerfile.cn +++ b/Dockerfile.cn @@ -1,5 +1,5 @@ # syntax=docker.io/docker/dockerfile:1 -FROM node:22-alpine AS base +FROM dockerp.com/node:22-alpine AS base FROM base AS deps RUN sed -i 's#https\?://dl-cdn.alpinelinux.org/alpine#https://mirror.nju.edu.cn/alpine#g' /etc/apk/repositories && \ @@ -10,21 +10,22 @@ COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* bun.lock* .npmrc # 统一配置所有包管理器使用淘宝源 RUN \ + npm config set registry https://registry.npmmirror.com && \ if [ -f yarn.lock ]; then \ - yarn config set registry https://registry.npmmirror.com && \ + # yarn config set registry https://registry.npmmirror.com && \ yarn --frozen-lockfile; \ elif [ -f package-lock.json ]; then \ npm ci --registry=https://registry.npmmirror.com; \ elif [ -f pnpm-lock.yaml ]; then \ corepack enable pnpm && \ - pnpm config set registry https://registry.npmmirror.com && \ + # pnpm config set registry https://registry.npmmirror.com && \ pnpm i --frozen-lockfile; \ elif [ -f bun.lock ]; then \ + sed -i 's#https\?://dl-cdn.alpinelinux.org/alpine#https://mirror.nju.edu.cn/alpine#g' /etc/apk/repositories && \ apk add --no-cache curl bash && \ - curl -fsSL https://bun.sh/install | bash && \ + npm install -g bun && \ export BUN_INSTALL="$HOME/.bun" && \ export PATH="$BUN_INSTALL/bin:$PATH" && \ - bun config set registry https://registry.npmmirror.com && \ bun install --frozen-lockfile; \ else echo "Lockfile not found." && exit 1; \ fi @@ -38,12 +39,14 @@ ENV NEXT_TELEMETRY_DISABLED=1 # 合并构建命令 RUN \ + npm config set registry https://registry.npmmirror.com && \ if [ -f yarn.lock ]; then yarn run build; \ elif [ -f package-lock.json ]; then npm run build; \ elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; \ elif [ -f bun.lock ]; then \ + sed -i 's#https\?://dl-cdn.alpinelinux.org/alpine#https://mirror.nju.edu.cn/alpine#g' /etc/apk/repositories && \ apk add --no-cache curl bash && \ - curl -fsSL https://bun.sh/install | bash && \ + npm install -g bun && \ export BUN_INSTALL="$HOME/.bun" && \ export PATH="$BUN_INSTALL/bin:$PATH" && \ bun run build; \ diff --git a/docker/lsp/clangd/Dockerfile.cn b/docker/lsp/clangd/Dockerfile.cn index 91677af..b38f1e6 100644 --- a/docker/lsp/clangd/Dockerfile.cn +++ b/docker/lsp/clangd/Dockerfile.cn @@ -1,4 +1,4 @@ -FROM alpine:latest AS builder +FROM dockerp.com/alpine:latest AS builder RUN sed -i 's#https\?://dl-cdn.alpinelinux.org/alpine#https://mirror.nju.edu.cn/alpine#g' /etc/apk/repositories&& \ apk add --no-cache git npm @@ -17,7 +17,7 @@ COPY servers.yml . # 合并命令减少镜像层 RUN npm install --registry=https://repo.nju.edu.cn/repository/npm/ && npm run prepare -FROM alpine:latest +FROM dockerp.com/alpine:latest RUN sed -i 's#https\?://dl-cdn.alpinelinux.org/alpine#https://mirror.nju.edu.cn/alpine#g' /etc/apk/repositories&& \ apk add --no-cache build-base clang-extra-tools nodejs