From 6d5fdd9c77bb32629da3d6006f2dbdff7f953297 Mon Sep 17 00:00:00 2001 From: "Habib Aliyu [CSOC]" Date: Thu, 24 Oct 2024 13:14:06 +0100 Subject: [PATCH 1/2] installation of nvm in a docker container --- .../docker-compose/Installing_NVM_Docker/test | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 docker-modules/docker-compose/Installing_NVM_Docker/test diff --git a/docker-modules/docker-compose/Installing_NVM_Docker/test b/docker-modules/docker-compose/Installing_NVM_Docker/test new file mode 100644 index 0000000..88b9d33 --- /dev/null +++ b/docker-modules/docker-compose/Installing_NVM_Docker/test @@ -0,0 +1,27 @@ +# First stage: Build environment to install dependencies and download NVM +FROM node:14 as build-stage + +# Update package list and install curl (only needed for the build stage) +RUN apt-get update && apt-get install -y curl + +# Install NVM using the official installation script +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash + +# Configure NVM environment to be available in all sessions +RUN echo "export NVM_DIR=\"$HOME/.nvm\"" >> ~/.bashrc \ + && echo "[ -s \"$NVM_DIR/nvm.sh\" ] && \. \"$NVM_DIR/nvm.sh\"" >> ~/.bashrc + +# Final stage: Create a clean image without unnecessary build dependencies +FROM node:14 + +# Copy NVM setup from the build stage +COPY --from=build-stage /app /app + +# Set working directory inside the container +WORKDIR /app + +# Source bash profile to load NVM +RUN source ~/.bashrc + +# Optional: install a specific Node.js version with NVM if needed +# RUN source ~/.bashrc && nvm install 16 \ No newline at end of file From 0228b8ddbe9725c4342391cc66010e8d2dbc6f94 Mon Sep 17 00:00:00 2001 From: "Habib Aliyu [CSOC]" Date: Fri, 25 Oct 2024 11:35:01 +0100 Subject: [PATCH 2/2] installation of nvm in a docker container --- .../docker-compose/Installing_NVM_Docker/test | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/docker-modules/docker-compose/Installing_NVM_Docker/test b/docker-modules/docker-compose/Installing_NVM_Docker/test index 88b9d33..6408833 100644 --- a/docker-modules/docker-compose/Installing_NVM_Docker/test +++ b/docker-modules/docker-compose/Installing_NVM_Docker/test @@ -1,9 +1,18 @@ +# Sets the base image of Docker container to Ubuntu 20.04 +FROM ubuntu:20.04 + # First stage: Build environment to install dependencies and download NVM FROM node:14 as build-stage # Update package list and install curl (only needed for the build stage) RUN apt-get update && apt-get install -y curl +# Copy NVM setup from the build stage +COPY --from=build-stage /app /app + +# Set working directory inside the container +WORKDIR /app + # Install NVM using the official installation script RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash @@ -14,12 +23,6 @@ RUN echo "export NVM_DIR=\"$HOME/.nvm\"" >> ~/.bashrc \ # Final stage: Create a clean image without unnecessary build dependencies FROM node:14 -# Copy NVM setup from the build stage -COPY --from=build-stage /app /app - -# Set working directory inside the container -WORKDIR /app - # Source bash profile to load NVM RUN source ~/.bashrc