Ramesh-vani commited on
Commit
bbfd20c
·
verified ·
1 Parent(s): 8064842

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -12
Dockerfile CHANGED
@@ -2,7 +2,7 @@
2
  FROM ubuntu:latest
3
 
4
  # Set working directory
5
- WORKDIR /home/devuser
6
 
7
  # Install system dependencies
8
  RUN apt update && apt install -y \
@@ -11,20 +11,22 @@ RUN apt update && apt install -y \
11
  openjdk-17-jdk \
12
  && apt clean && rm -rf /var/lib/apt/lists/*
13
 
14
- # Install NVM and Node.js
15
- RUN curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash && \
16
- bash -c 'export NVM_DIR="$HOME/.nvm" && \
17
- [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" && \
18
- nvm install --lts && nvm use --lts && \
19
- echo "export NVM_DIR=\"$HOME/.nvm\"" >> ~/.bashrc && \
20
- echo "[ -s \"$NVM_DIR/nvm.sh\" ] && . \"$NVM_DIR/nvm.sh\"" >> ~/.bashrc && \
21
- echo "export PATH=\"$NVM_DIR/versions/node/$(nvm current)/bin:$PATH\"" >> ~/.bashrc'
22
 
23
- # Set environment variables for Node.js
24
  ENV NVM_DIR="/root/.nvm"
25
- ENV PATH="$NVM_DIR/versions/node/$(nvm current)/bin:$PATH"
 
 
 
 
 
 
 
 
26
 
27
  # Verify Node.js installation
28
- RUN bash -c 'source ~/.bashrc && node -v && npm -v'
29
 
30
  CMD ["bash"]
 
2
  FROM ubuntu:latest
3
 
4
  # Set working directory
5
+ WORKDIR /root
6
 
7
  # Install system dependencies
8
  RUN apt update && apt install -y \
 
11
  openjdk-17-jdk \
12
  && apt clean && rm -rf /var/lib/apt/lists/*
13
 
14
+ # Install NVM
15
+ RUN curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
 
 
 
 
 
 
16
 
17
+ # Set NVM environment variables
18
  ENV NVM_DIR="/root/.nvm"
19
+ ENV PATH="$NVM_DIR/versions/node/v22.13.1/bin:$PATH"
20
+
21
+ # Install Node.js using NVM
22
+ RUN bash -c 'source $NVM_DIR/nvm.sh && nvm install --lts && nvm use --lts'
23
+
24
+ # Ensure Node.js is available in future sessions
25
+ RUN echo 'export NVM_DIR="/root/.nvm"' >> /root/.bashrc && \
26
+ echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"' >> /root/.bashrc && \
27
+ echo 'export PATH="$NVM_DIR/versions/node/$(nvm current)/bin:$PATH"' >> /root/.bashrc
28
 
29
  # Verify Node.js installation
30
+ RUN node -v && npm -v
31
 
32
  CMD ["bash"]