#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)
|
# Install Node.js from the official NodeSource repository (no NVM)
|
||||||
# -------------------------------------------------------------------
|
# -------------------------------------------------------------------
|
||||||
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key \
|
RUN curl -fsSL "https://deb.nodesource.com/setup_${NODE_MAJOR}.x" | bash - && \
|
||||||
| gpg --dearmor -o /usr/share/keyrings/nodesource.gpg && \
|
apt-get update && apt-get install -y nodejs npm && \
|
||||||
echo "deb [signed-by=/usr/share/keyrings/nodesource.gpg] \
|
# Clean up apt cache to reduce image size
|
||||||
https://deb.nodesource.com/node_${ARG_NODE_MAJOR}.x nodistro main" \
|
rm -rf /var/lib/apt/lists/*
|
||||||
> /etc/apt/sources.list.d/nodesource.list && \
|
|
||||||
apt-get update && \
|
|
||||||
apt-get install -y nodejs && \
|
|
||||||
# optional: verify installation
|
|
||||||
node --version && npm --version \
|
|
||||||
|
|
||||||
# -------------------------------------------------------------------
|
# -------------------------------------------------------------------
|
||||||
# Global npm tools
|
# Global npm tools
|
||||||
|
@ -75,3 +71,7 @@ RUN curl -sL ${GITIGNORE_URL} -o /home/coder/.gitignore && \
|
||||||
|
|
||||||
# Install Firebase CLI
|
# Install Firebase CLI
|
||||||
RUN curl -sL firebase.tools | bash
|
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