manabb commited on
Commit
dd084cc
·
verified ·
1 Parent(s): b41f268

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -22
Dockerfile CHANGED
@@ -1,33 +1,30 @@
1
- # 1. Use a slim Debian-based image
2
  FROM debian:11-slim
3
 
4
- # Set environment variables
5
  ENV DEBIAN_FRONTEND=noninteractive
6
  ENV HOME=/home/user \
7
  PATH=/home/user/.local/bin:$PATH
8
 
9
- # 2. Install essential tools and Node.js
10
- RUN apt-get update && apt-get install -y \
11
- curl \
12
- git \
13
- sudo \
14
- && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
15
- && apt-get install -y nodejs \
16
- && rm -rf /var/lib/apt/lists/*
17
 
18
- # 3. Install VS Code (code-server)
19
- RUN curl -fsSL https://code-server.dev/install.sh | sh
 
20
 
21
- # 4. Create user and set up permissions properly
22
- RUN useradd -m -u 1000 user && \
23
- mkdir -p $HOME/app $HOME/.config $HOME/.local/share/code-server && \
24
- chown -R user:user $HOME
25
 
26
- USER user
27
- WORKDIR $HOME/app
28
 
29
- # 5. Expose the Hugging Face port
30
- EXPOSE 7860
31
 
32
- # 6. Start VS Code with explicit user-data and config directories
33
- CMD ["code-server", "--bind-addr", "0.0.0.0:7860", "--auth", "none", "--user-data-dir", "/home/user/.local/share/code-server", "--config", "/home/user/.config/code-server/config.yaml", "."]
 
1
+ # 1. Base Image
2
  FROM debian:11-slim
3
 
 
4
  ENV DEBIAN_FRONTEND=noninteractive
5
  ENV HOME=/home/user \
6
  PATH=/home/user/.local/bin:$PATH
7
 
8
+ # 2. Install Node and VS Code
9
+ RUN apt-get update && apt-get install -y curl git sudo && \
10
+ curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
11
+ apt-get install -y nodejs && \
12
+ curl -fsSL https://code-server.dev/install.sh | sh && \
13
+ rm -rf /var/lib/apt/lists/*
 
 
14
 
15
+ # 3. Setup User
16
+ RUN useradd -m -u 1000 user
17
+ WORKDIR $HOME/app
18
 
19
+ # 4. PRE-CREATE CONFIG DIR AND COPY YOUR FILE
20
+ # We create the folder first, then copy the file into it
21
+ RUN mkdir -p $HOME/.config/code-server
22
+ COPY --chown=user:user config.yaml $HOME/.config/code-server/config.yaml
23
 
24
+ # 5. Fix permissions for the entire home directory
25
+ RUN chown -R user:user $HOME
26
 
27
+ USER user
 
28
 
29
+ # 6. Start VS Code using that config file
30
+ CMD ["code-server", "--config", "/home/user/.config/code-server/config.yaml", "."]