Refactor Dockerfile to streamline Node.js and Python installation process
This commit is contained in:
27
Dockerfile
27
Dockerfile
@@ -1,23 +1,28 @@
|
|||||||
FROM ubuntu:24.04
|
FROM ubuntu:24.04
|
||||||
|
|
||||||
LABEL maintainer="thommyho"
|
LABEL maintainer="thommyho"
|
||||||
LABEL description="An Ubuntu 24.04 image with essential tools for git development and CI/CD pipelines."
|
LABEL description="An Ubuntu 24.04 image with essential tools for git development and CI/CD pipelines."
|
||||||
RUN apt-get update && apt-get install -y \
|
|
||||||
|
ENV NVM_DIR=/usr/local/nvm \
|
||||||
|
NODE_VERSION=24.11.1 \
|
||||||
|
NODE_PATH=/usr/local/nvm/v24.11.1/lib/node_modules \
|
||||||
|
PATH=/usr/local/nvm/versions/node/v24.11.1/bin:$PATH
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
git \
|
git \
|
||||||
curl \
|
curl \
|
||||||
wget \
|
wget \
|
||||||
build-essential \
|
build-essential \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
|
python3 \
|
||||||
|
python3-pip \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
# nvm environment variables
|
|
||||||
RUN mkdir -p /usr/local/nvm
|
RUN pip install conan --break-system-packages
|
||||||
ENV NVM_DIR=/usr/local/nvm
|
|
||||||
ENV NODE_VERSION=24.11.1
|
RUN mkdir -p $NVM_DIR && \
|
||||||
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
|
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash && \
|
||||||
RUN . $NVM_DIR/nvm.sh && \
|
. $NVM_DIR/nvm.sh && \
|
||||||
nvm install $NODE_VERSION && \
|
nvm install $NODE_VERSION && \
|
||||||
nvm use $NODE_VERSION && \
|
nvm use $NODE_VERSION && \
|
||||||
nvm alias default $NODE_VERSION
|
nvm alias default $NODE_VERSION
|
||||||
# add node and npm to path so the commands are available
|
|
||||||
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
|
|
||||||
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
|
|
||||||
# RUN node -v && npm -v
|
|
||||||
Reference in New Issue
Block a user