arnob69 commited on
Commit
195a06b
·
verified ·
1 Parent(s): 2e79502

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -9
Dockerfile CHANGED
@@ -2,31 +2,33 @@ FROM ubuntu:22.04
2
 
3
  ENV DEBIAN_FRONTEND=noninteractive
4
 
5
- # Install system utilities
6
  RUN apt-get update && apt-get install -y \
7
  curl \
8
  git \
9
  sudo \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
- # Download OpenVSCode Server binary
13
  RUN curl -fsSL "https://github.com/gitpod-io/openvscode-server/releases/download/openvscode-server-v1.85.1/openvscode-server-v1.85.1-linux-x64.tar.gz" | tar -xz -C /opt
14
 
15
- # Install Node.js & Freebuff coding assistant
16
  RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
17
  && apt-get install -y nodejs \
18
  && npm install -g freebuff
19
 
20
- # Configure non-root user permissions for Hugging Face Spaces
21
  RUN useradd -m -u 1000 user && \
22
  echo "user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
23
 
24
- # Create workspace folders with absolute open-permissions to prevent the "overwrite flag" lockouts
 
 
 
 
25
  RUN mkdir -p /home/user/workspace && \
26
  chown -R user:user /home/user && \
27
  chmod -R 777 /home/user
28
 
29
- # Setup your Windows command terminal aliases
30
  RUN echo 'alias dir="ls -la"' >> /home/user/.bashrc && \
31
  echo 'alias cls="clear"' >> /home/user/.bashrc && \
32
  echo 'alias copy="cp"' >> /home/user/.bashrc && \
@@ -39,9 +41,9 @@ RUN echo 'alias dir="ls -la"' >> /home/user/.bashrc && \
39
  USER user
40
  ENV HOME=/home/user \
41
  PATH=/home/user/.local/bin:$PATH
42
- WORKDIR /home/user/workspace
43
 
44
  EXPOSE 7860
45
 
46
- # Fire up OpenVSCode directly on the main port to drop all middleware errors
47
- CMD ["/opt/openvscode-server-v1.85.1-linux-x64/bin/openvscode-server", "--host", "0.0.0.0", "--port", "7860", "--without-connection-token", "--workspace", "/home/user/workspace"]
 
2
 
3
  ENV DEBIAN_FRONTEND=noninteractive
4
 
 
5
  RUN apt-get update && apt-get install -y \
6
  curl \
7
  git \
8
  sudo \
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
+ # Install OpenVSCode Server
12
  RUN curl -fsSL "https://github.com/gitpod-io/openvscode-server/releases/download/openvscode-server-v1.85.1/openvscode-server-v1.85.1-linux-x64.tar.gz" | tar -xz -C /opt
13
 
14
+ # Install Node.js & Freebuff globally
15
  RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
16
  && apt-get install -y nodejs \
17
  && npm install -g freebuff
18
 
 
19
  RUN useradd -m -u 1000 user && \
20
  echo "user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
21
 
22
+ # CRITICAL PERMISSIONS FIX: Pre-create /data tracks as root and give user 1000 full access
23
+ RUN mkdir -p /data /data/.vscode-user /data/.vscode-extensions && \
24
+ chown -R user:user /data && \
25
+ chmod -R 777 /data
26
+
27
  RUN mkdir -p /home/user/workspace && \
28
  chown -R user:user /home/user && \
29
  chmod -R 777 /home/user
30
 
31
+ # Setup Windows terminal aliases
32
  RUN echo 'alias dir="ls -la"' >> /home/user/.bashrc && \
33
  echo 'alias cls="clear"' >> /home/user/.bashrc && \
34
  echo 'alias copy="cp"' >> /home/user/.bashrc && \
 
41
  USER user
42
  ENV HOME=/home/user \
43
  PATH=/home/user/.local/bin:$PATH
44
+ WORKDIR /data
45
 
46
  EXPOSE 7860
47
 
48
+ # Launch VS Code pointing directly to our unlocked persistent partition
49
+ CMD ["/opt/openvscode-server-v1.85.1-linux-x64/bin/openvscode-server", "--host", "0.0.0.0", "--port", "7860", "--without-connection-token", "--workspace", "/data", "--user-data-dir", "/data/.vscode-user", "--extensions-dir", "/data/.vscode-extensions"]