Vexxxxxxxxxxxxx commited on
Commit
84a1cf7
·
verified ·
1 Parent(s): 068f4df

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -6
Dockerfile CHANGED
@@ -16,6 +16,7 @@ RUN apt-get update && apt-get install -y \
16
  libasound2 \
17
  sudo \
18
  ttyd \
 
19
  && apt-get clean
20
 
21
  # 2. Install Google Chrome
@@ -24,22 +25,24 @@ RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key
24
  && apt-get update && apt-get install -y google-chrome-stable
25
 
26
  # 3. Create a user for Hugging Face (UID 1000)
27
- # Hugging Face doesn't like running as root
28
  RUN useradd -m -u 1000 user && \
29
- echo "user ALL=(ALL) NOPASSWD:ALL" >> /etc/etc/sudoers
 
30
  USER user
31
  ENV HOME=/home/user \
32
  PATH=/home/user/.local/bin:$PATH
33
  WORKDIR $HOME/app
34
 
35
- # 4. Setup the "Binary Hijack" script in the user's path
 
36
  RUN mkdir -p $HOME/.local/bin && \
37
  echo '#!/bin/bash\n/usr/bin/google-chrome-stable --no-sandbox --headless --disable-dev-shm-usage --disable-gpu "$@"' > $HOME/.local/bin/google-chrome && \
38
  chmod +x $HOME/.local/bin/google-chrome
39
 
40
- # 5. Expose the port Hugging Face requires
41
  EXPOSE 7860
42
 
43
- # 6. Start a web-based terminal on port 7860
44
- # This keeps the container running and lets you type commands in your browser
45
  CMD ["ttyd", "-p", "7860", "bash"]
 
16
  libasound2 \
17
  sudo \
18
  ttyd \
19
+ gnupg \
20
  && apt-get clean
21
 
22
  # 2. Install Google Chrome
 
25
  && apt-get update && apt-get install -y google-chrome-stable
26
 
27
  # 3. Create a user for Hugging Face (UID 1000)
28
+ # FIXED: Changed /etc/etc/sudoers to /etc/sudoers
29
  RUN useradd -m -u 1000 user && \
30
+ echo "user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
31
+
32
  USER user
33
  ENV HOME=/home/user \
34
  PATH=/home/user/.local/bin:$PATH
35
  WORKDIR $HOME/app
36
 
37
+ # 4. Setup the "Binary Hijack" script
38
+ # This ensures Chrome always runs with the necessary VPS flags
39
  RUN mkdir -p $HOME/.local/bin && \
40
  echo '#!/bin/bash\n/usr/bin/google-chrome-stable --no-sandbox --headless --disable-dev-shm-usage --disable-gpu "$@"' > $HOME/.local/bin/google-chrome && \
41
  chmod +x $HOME/.local/bin/google-chrome
42
 
43
+ # 5. Hugging Face uses port 7860
44
  EXPOSE 7860
45
 
46
+ # 6. Start the web terminal
47
+ # This keeps the Space alive and gives you a terminal in your browser
48
  CMD ["ttyd", "-p", "7860", "bash"]