@xcanwin/manyoyo 7.1.2 → 7.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,14 @@
1
1
  # ==============================================================================
2
2
  # Stage 1: 缓存准备阶段 - 智能检测缓存或下载
3
3
  # ==============================================================================
4
+ # 镜像源参数化(默认使用阿里云,可按需覆盖),两个阶段共享同一默认值
5
+ ARG APT_MIRROR=https://mirrors.aliyun.com
6
+
4
7
  FROM ubuntu:24.04 AS cache-stage
5
8
 
6
9
  ARG TARGETARCH
7
10
  ARG TOOL="common"
11
+ ARG APT_MIRROR
8
12
 
9
13
  # 复制缓存目录(可能为空)
10
14
  COPY ./docker/cache/ /cache/
@@ -18,14 +22,25 @@ RUN <<EOX
18
22
  *) ARCH_NODE="$TARGETARCH"; ARCH_GO="$TARGETARCH" ;;
19
23
  esac
20
24
 
25
+ # 基础镜像不带 curl,仅在需要下载时按需安装
26
+ ensure_curl() {
27
+ if command -v curl > /dev/null 2>&1; then return 0; fi
28
+ echo "安装 curl(缓存缺失,需联网下载)"
29
+ sed -i "s|http://[^/]*\.ubuntu\.com|${APT_MIRROR}|g" /etc/apt/sources.list.d/ubuntu.sources
30
+ apt-get -o Acquire::https::Verify-Peer=false update -y
31
+ apt-get -o Acquire::https::Verify-Peer=false install -y --no-install-recommends curl ca-certificates
32
+ }
33
+
21
34
  # Node.js: 检测缓存,不存在则下载
22
35
  mkdir -p /opt/node
23
36
  if ls /cache/node/node-*-linux-${ARCH_NODE}.tar.gz 1> /dev/null 2>&1; then
24
37
  echo "使用 Node.js 缓存"
25
- NODE_TAR=$(ls /cache/node/node-*-linux-${ARCH_NODE}.tar.gz | head -1)
38
+ # 缓存目录可能残留旧版本,取版本号最大的一个
39
+ NODE_TAR=$(ls /cache/node/node-*-linux-${ARCH_NODE}.tar.gz | sort -V | tail -1)
26
40
  tar -xzf ${NODE_TAR} -C /opt/node --strip-components=1 --exclude='*.md' --exclude='LICENSE' --no-same-owner
27
41
  else
28
42
  echo "下载 Node.js"
43
+ ensure_curl
29
44
  NVM_NODEJS_ORG_MIRROR=https://mirrors.tencent.com/nodejs-release/
30
45
  NODE_TAR=$(curl -sL ${NVM_NODEJS_ORG_MIRROR}/latest-v24.x/SHASUMS256.txt | grep linux-${ARCH_NODE}.tar.gz | awk '{print $2}')
31
46
  curl -fsSL ${NVM_NODEJS_ORG_MIRROR}/latest-v24.x/${NODE_TAR} | tar -xz -C /opt/node --strip-components=1 --exclude='*.md' --exclude='LICENSE'
@@ -39,6 +54,7 @@ RUN <<EOX
39
54
  tar -xzf /cache/jdtls/jdt-language-server-latest.tar.gz -C /opt/jdtls --no-same-owner
40
55
  else
41
56
  echo "下载 JDT LSP"
57
+ ensure_curl
42
58
  curl -fsSL https://download.eclipse.org/jdtls/snapshots/jdt-language-server-latest.tar.gz | tar -xz -C /opt/jdtls
43
59
  fi
44
60
  ;; esac
@@ -67,8 +83,8 @@ ARG TARGETARCH
67
83
  ARG NODE_VERSION=24
68
84
  ARG TOOL="common"
69
85
 
70
- # 镜像源参数化(默认使用阿里云,可按需覆盖)
71
- ARG APT_MIRROR=https://mirrors.aliyun.com
86
+ # 镜像源参数化(APT_MIRROR 继承 FROM 之前的全局默认值)
87
+ ARG APT_MIRROR
72
88
  ARG NPM_REGISTRY=https://mirrors.tencent.com/npm/
73
89
  ARG PIP_INDEX_URL=https://mirrors.tencent.com/pypi/simple
74
90
  # 轻量级文本解析依赖(可通过 --build-arg 覆盖)