This PR addresses the issue where `npx` and `node` were not available in the action pipelines. Additionally, it removes the reliance on `nvm` for installation. Instead, the latest available LTS version of Node.js is installed during the image build process, ensuring compatibility and seamless execution in the pipelines. This closes #2 Reviewed-on: #3 Co-authored-by: Guillaume "B.B." Van Hemmen <GuillaumeHemmen@noreply.git.van-hemmen.com> Co-committed-by: Guillaume "B.B." Van Hemmen <GuillaumeHemmen@noreply.git.van-hemmen.com>
This commit is contained in:
parent
fdc8276d0e
commit
109e09b941
1 changed files with 23 additions and 20 deletions
43
Dockerfile
43
Dockerfile
|
@ -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)"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue