himanshu-711 commited on
Commit
030314c
·
verified ·
1 Parent(s): 038c2be

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +26 -6
Dockerfile CHANGED
@@ -1,16 +1,36 @@
 
1
  FROM ubuntu:22.04
2
 
3
- # Install dependencies and code-server
4
- RUN apt-get update && apt-get install -y curl
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  RUN curl -fsSL https://code-server.dev/install.sh | sh
6
 
7
- # Create a user (Hugging Face doesn't like running as root)
8
- RUN useradd -m -u 1000 user
 
 
 
9
  USER user
10
  ENV HOME=/home/user \
11
  PATH=/home/user/.local/bin:$PATH
12
-
13
  WORKDIR $HOME
14
 
15
- # Start code-server on port 7860 (The port Hugging Face expects)
 
 
 
16
  CMD ["code-server", "--bind-addr", "0.0.0.0:7860", "--auth", "none", "."]
 
1
+ # Use a stable Ubuntu base
2
  FROM ubuntu:22.04
3
 
4
+ # Avoid prompts during package installation
5
+ ENV DEBIAN_FRONTEND=noninteractive
6
+
7
+ # 1. Install sudo, git, and basic build tools
8
+ RUN apt-get update && apt-get install -y \
9
+ sudo \
10
+ git \
11
+ curl \
12
+ wget \
13
+ build-essential \
14
+ python3 \
15
+ python3-pip \
16
+ unzip \
17
+ && rm -rf /var/lib/apt/lists/*
18
+
19
+ # 2. Install code-server (VS Code Web)
20
  RUN curl -fsSL https://code-server.dev/install.sh | sh
21
 
22
+ # 3. Create a user 'user' with ID 1000 (HF requirement)
23
+ RUN useradd -m -u 1000 user && \
24
+ echo "user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
25
+
26
+ # 4. Set environment variables
27
  USER user
28
  ENV HOME=/home/user \
29
  PATH=/home/user/.local/bin:$PATH
 
30
  WORKDIR $HOME
31
 
32
+ # 5. Expose the port HF uses
33
+ EXPOSE 7860
34
+
35
+ # 6. Start code-server on the correct port with no password for ease of use
36
  CMD ["code-server", "--bind-addr", "0.0.0.0:7860", "--auth", "none", "."]