Pepguy commited on
Commit
5fbbb26
·
verified ·
1 Parent(s): f89fbfc

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -13
Dockerfile CHANGED
@@ -2,36 +2,38 @@ FROM ubuntu:22.04
2
 
3
  # Prevent interactive prompts during apt installations
4
  ENV DEBIAN_FRONTEND=noninteractive
5
- ENV HOME=/home/user
6
 
7
- # 1. Install base utilities and development tools (Node, Python)
8
  RUN apt-get update && apt-get install -y \
9
  curl wget git jq unzip build-essential \
10
  python3 python3-pip \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
- # 2. Install VS Code Server (code-server)
14
  RUN curl -fsSL https://code-server.dev/install.sh | sh
15
 
16
- # 3. Setup Hugging Face user (UID 1000)
17
  RUN useradd -m -u 1000 user
18
- USER user
19
 
20
- # Set up paths for Rust, Bun, and Node
 
21
  ENV PATH="/home/user/.local/bin:/home/user/.cargo/bin:/home/user/.bun/bin:$PATH"
 
 
 
 
 
 
22
  WORKDIR $HOME
23
 
24
- # 4. Install Rust
25
  RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
26
 
27
- # 5. Install Bun (unzip is now installed, so this succeeds)
28
  RUN curl -fsSL https://bun.sh/install | bash
29
 
30
- # Expose port 7860
31
  EXPOSE 7860
32
 
33
- # 6. Start VS Code Server on Hugging Face's port
34
- # NOTE: "--auth none" is safe ONLY if your Space is PRIVATE.
35
- # If you make your Space public, change "--auth none" to "--auth password"
36
- # and set the env variable "ENV PASSWORD=your_secure_password"
37
  CMD ["code-server", "--bind-addr", "0.0.0.0:7860", "--auth", "none", "--disable-telemetry"]
 
2
 
3
  # Prevent interactive prompts during apt installations
4
  ENV DEBIAN_FRONTEND=noninteractive
 
5
 
6
+ # 1. Install base utilities as root
7
  RUN apt-get update && apt-get install -y \
8
  curl wget git jq unzip build-essential \
9
  python3 python3-pip \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
+ # 2. Install VS Code Server (code-server) as root
13
  RUN curl -fsSL https://code-server.dev/install.sh | sh
14
 
15
+ # 3. Create the Hugging Face user (UID 1000)
16
  RUN useradd -m -u 1000 user
 
17
 
18
+ # 4. Set up environment variables
19
+ ENV HOME=/home/user
20
  ENV PATH="/home/user/.local/bin:/home/user/.cargo/bin:/home/user/.bun/bin:$PATH"
21
+
22
+ # 5. CRITICAL FIX: Transfer ownership of the home directory from root to user
23
+ RUN chown -R user:user /home/user
24
+
25
+ # 6. Switch to the non-root user
26
+ USER user
27
  WORKDIR $HOME
28
 
29
+ # 7. Install Rust (Will now succeed because permissions are fixed)
30
  RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
31
 
32
+ # 8. Install Bun
33
  RUN curl -fsSL https://bun.sh/install | bash
34
 
35
+ # Expose port
36
  EXPOSE 7860
37
 
38
+ # Start VS Code Server
 
 
 
39
  CMD ["code-server", "--bind-addr", "0.0.0.0:7860", "--auth", "none", "--disable-telemetry"]