#2 - Simplify NodeSource setup, clean up Dockerfile
Streamlined Node.js installation using NodeSource setup script, added cache cleanup to reduce image size, and updated verification step.
This commit is contained in:
parent
6501875d17
commit
99210a7ad2
1 changed files with 9 additions and 9 deletions
18
Dockerfile
18
Dockerfile
|
@ -35,15 +35,11 @@ RUN apt-get update && \
|
|||
# -------------------------------------------------------------------
|
||||
# Install Node.js from the official NodeSource repository (no NVM)
|
||||
# -------------------------------------------------------------------
|
||||
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key \
|
||||
| gpg --dearmor -o /usr/share/keyrings/nodesource.gpg && \
|
||||
echo "deb [signed-by=/usr/share/keyrings/nodesource.gpg] \
|
||||
https://deb.nodesource.com/node_${ARG_NODE_MAJOR}.x nodistro main" \
|
||||
> /etc/apt/sources.list.d/nodesource.list && \
|
||||
apt-get update && \
|
||||
apt-get install -y nodejs && \
|
||||
# optional: verify installation
|
||||
node --version && npm --version \
|
||||
RUN curl -fsSL "https://deb.nodesource.com/setup_${NODE_MAJOR}.x" | bash - && \
|
||||
apt-get update && apt-get install -y nodejs npm && \
|
||||
# Clean up apt cache to reduce image size
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
# Global npm tools
|
||||
|
@ -75,3 +71,7 @@ RUN curl -sL ${GITIGNORE_URL} -o /home/coder/.gitignore && \
|
|||
|
||||
# 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