shashwatIDR commited on
Commit
5079579
·
verified ·
1 Parent(s): 24c7dbc

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +24 -4
Dockerfile CHANGED
@@ -1,23 +1,43 @@
1
  FROM codercom/code-server:latest
2
 
3
- # Switch to root user temporarily for installations
4
  USER root
5
 
6
- # Install Python and Node.js
7
  RUN apt-get update && \
8
- apt-get install -y python3 python3-pip curl && \
 
 
 
 
 
 
 
9
  curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
10
  apt-get install -y nodejs && \
11
  apt-get clean && \
12
  rm -rf /var/lib/apt/lists/*
13
 
 
 
 
14
  # Create the working directory and set proper ownership
15
  RUN mkdir -p /animesh && \
16
  chown -R coder:coder /animesh
17
 
18
- # Switch back to the coder user (this is important for fixuid to work properly)
 
 
 
 
19
  USER coder
20
 
 
 
 
 
 
 
21
  # Set the working directory
22
  WORKDIR /animesh
23
 
 
1
  FROM codercom/code-server:latest
2
 
3
+ # Switch to root user for setup
4
  USER root
5
 
6
+ # Install Python, Node.js, and other development tools
7
  RUN apt-get update && \
8
+ apt-get install -y \
9
+ python3 \
10
+ python3-pip \
11
+ python3-venv \
12
+ curl \
13
+ git \
14
+ build-essential \
15
+ sudo && \
16
  curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
17
  apt-get install -y nodejs && \
18
  apt-get clean && \
19
  rm -rf /var/lib/apt/lists/*
20
 
21
+ # Give coder user sudo privileges without password for package management
22
+ RUN echo "coder ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
23
+
24
  # Create the working directory and set proper ownership
25
  RUN mkdir -p /animesh && \
26
  chown -R coder:coder /animesh
27
 
28
+ # Set up npm global directory for coder user to avoid permission issues
29
+ RUN mkdir -p /home/coder/.npm-global && \
30
+ chown -R coder:coder /home/coder/.npm-global
31
+
32
+ # Switch back to coder user
33
  USER coder
34
 
35
+ # Configure npm to use user-owned global directory
36
+ RUN npm config set prefix '/home/coder/.npm-global'
37
+
38
+ # Update PATH to include npm global binaries and local binaries
39
+ ENV PATH="/home/coder/.npm-global/bin:/home/coder/.local/bin:$PATH"
40
+
41
  # Set the working directory
42
  WORKDIR /animesh
43