- Fix: Ensure npx and node Availability #3

Merged
GuillaumeHemmen merged 5 commits from fix/2-npx-and-node-not-available-in-the-action-pipelines into master 2025-07-14 18:45:15 +00:00

View file

@ -17,23 +17,35 @@ RUN ln -snf /usr/share/zoneinfo/$ARG_TZ /etc/localtime && \
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y \
# Development tools
build-essential \
git \
python3 \
# System utilities
ca-certificates \
curl \
git \
gnupg2 \
jq \
nano \
procps \
python3 \
sudo \
unzip \
wget \
nano \
jq && \
wget && \
# Clean up apt cache to reduce image size
rm -rf /var/lib/apt/lists/*
# -------------------------------------------------------------------
# Install Node.js from the official NodeSource repository (no NVM)
# -------------------------------------------------------------------
RUN curl -fsSL "https://deb.nodesource.com/setup_${ARG_NODE_MAJOR}.x" | bash - && \
apt-get update && apt-get install -y nodejs && \
# Clean up apt cache to reduce image size
rm -rf /var/lib/apt/lists/*
# -------------------------------------------------------------------
# Global npm tools
# -------------------------------------------------------------------
RUN npm i -g yarn patch-package
# User setup and security configuration
# Create non-root user 'coder' with sudo privileges
RUN useradd -m -s /bin/bash -G sudo coder && \
@ -53,22 +65,13 @@ RUN curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/
# Switch to non-root user
USER coder
# Configure bash environment
ENV BASH_ENV /home/coder/.bash_env
RUN touch "${BASH_ENV}" && \
echo '. "${BASH_ENV}"' >> ~/.bashrc
# Set up global gitignore
RUN curl -sL ${GITIGNORE_URL} -o /home/coder/.gitignore && \
git config --global core.excludesfile /home/coder/.gitignore
# Install Node.js using NVM
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | PROFILE="${BASH_ENV}" bash && \
. $BASH_ENV && \
nvm install ${ARG_NODE_MAJOR} && \
nvm alias default ${ARG_NODE_MAJOR} && \
nvm use ${ARG_NODE_MAJOR} && \
npm i -g yarn patch-package
# Install Firebase CLI
RUN curl -sL firebase.tools | bash
# optional: verify installation \
RUN echo "node version $(node --version) | npm version $(npm --version)"