22 lines
927 B
Docker
22 lines
927 B
Docker
# Gitea Action Runner Node.js Image
|
|
# 基于 gitea_runner_base 添加多版本 Node.js 和包管理器
|
|
|
|
FROM timi/gitea_runner_base:latest
|
|
|
|
LABEL maintainer="www.imyeyu.com"
|
|
LABEL description="Gitea Action Runner with Node.js 18/20/22 and multiple package managers"
|
|
|
|
# Node.js 安装目录
|
|
ENV NODE_BASE=/usr/local/node
|
|
|
|
# 安装 Node.js 多版本环境和包管理器
|
|
RUN npm install -g n \
|
|
&& mkdir -p ${NODE_BASE} \
|
|
&& n install 18 \
|
|
&& n install 20 \
|
|
&& n install 22 \
|
|
&& n use 20 \
|
|
&& npm install -g yarn pnpm \
|
|
&& printf '#!/bin/bash\ncase "$1" in\n 18|20|22)\n n use "$1" > /dev/null 2>&1\n export PATH="/usr/local/n/versions/node/$1/bin:${PATH}"\n echo "Switched to Node.js $1: $(node -v)"\n ;;\n *)\n echo "Usage: source use-node [18|20|22]"\n return 1\n ;;\nesac\n' > /usr/local/bin/use-node \
|
|
&& chmod +x /usr/local/bin/use-node
|