ci: updated base-image

This commit is contained in:
Marvin Zhang
2024-11-23 10:51:46 +08:00
parent b4c233f122
commit f016d279d1
15 changed files with 258 additions and 134 deletions

View File

@@ -5,15 +5,16 @@ version="22"
# Install nvm (Node Version Manager)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
# Add nvm to path
echo 'export NVM_DIR="$HOME/.nvm"' >> ~/.bashrc
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.bashrc
echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion' >> ~/.bashrc
# Create a file in /etc/profile.d/
cat > /etc/profile.d/node-env.sh << 'EOF'
export NVM_DIR="/root/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
export NODE_PATH=/usr/lib/node_modules
EOF
# Ensure changes take effect immediately
export NVM_DIR="$HOME/.nvm"
[[ -s "$NVM_DIR/nvm.sh" ]] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[[ -s "$NVM_DIR/bash_completion" ]] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# Make the file executable
chmod +x /etc/profile.d/node-env.sh
# Download and install Node.js (you may need to restart the terminal)
nvm install ${version}