Refactor Dockerfile to streamline Node.js and Python installation process
This commit is contained in:
29
Dockerfile
29
Dockerfile
@@ -1,23 +1,28 @@
|
||||
FROM ubuntu:24.04
|
||||
|
||||
LABEL maintainer="thommyho"
|
||||
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 \
|
||||
curl \
|
||||
wget \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
python3 \
|
||||
python3-pip \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
# nvm environment variables
|
||||
RUN mkdir -p /usr/local/nvm
|
||||
ENV NVM_DIR=/usr/local/nvm
|
||||
ENV NODE_VERSION=24.11.1
|
||||
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
|
||||
RUN . $NVM_DIR/nvm.sh && \
|
||||
|
||||
RUN pip install conan --break-system-packages
|
||||
|
||||
RUN mkdir -p $NVM_DIR && \
|
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash && \
|
||||
. $NVM_DIR/nvm.sh && \
|
||||
nvm install $NODE_VERSION && \
|
||||
nvm use $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
|
||||
nvm alias default $NODE_VERSION
|
||||
Reference in New Issue
Block a user