chipling commited on
Commit
05bbd13
·
verified ·
1 Parent(s): ccb8d4b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +32 -6
Dockerfile CHANGED
@@ -1,22 +1,24 @@
1
- # Use a base Ubuntu image with Python
2
- FROM python:3.9-slim-buster
3
 
4
- # 1. Install system dependencies (XFCE Desktop, VNC, Audio tools)
5
  # We suppress prompts to avoid build errors
6
  ENV DEBIAN_FRONTEND=noninteractive
 
7
  RUN apt-get update && apt-get install -y \
8
  xfce4 \
9
  xfce4-terminal \
10
  xvfb \
11
  x11vnc \
12
  novnc \
13
- python3-websockify \
14
- python3-numpy \
15
  firefox-esr \
16
  sudo \
17
  curl \
18
  git \
19
  vim \
 
20
  && rm -rf /var/lib/apt/lists/*
21
 
22
  # 2. Setup a non-root user (Hugging Face Spaces defaults to UID 1000)
@@ -30,7 +32,31 @@ ENV HOME=/home/user \
30
  WORKDIR $HOME
31
 
32
  # 4. Create the start script
33
- COPY --chown=user start.sh start.sh
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  RUN chmod +x start.sh
35
 
36
  # 5. Expose the Hugging Face port
 
1
+ # Use the latest supported python slim image (Debian Bookworm)
2
+ FROM python:3.9-slim
3
 
4
+ # 1. Install system dependencies
5
  # We suppress prompts to avoid build errors
6
  ENV DEBIAN_FRONTEND=noninteractive
7
+
8
  RUN apt-get update && apt-get install -y \
9
  xfce4 \
10
  xfce4-terminal \
11
  xvfb \
12
  x11vnc \
13
  novnc \
14
+ websockify \
15
+ numpy \
16
  firefox-esr \
17
  sudo \
18
  curl \
19
  git \
20
  vim \
21
+ procps \
22
  && rm -rf /var/lib/apt/lists/*
23
 
24
  # 2. Setup a non-root user (Hugging Face Spaces defaults to UID 1000)
 
32
  WORKDIR $HOME
33
 
34
  # 4. Create the start script
35
+ # We write the script directly here to avoid permission issues with COPY
36
+ RUN echo '#!/bin/bash\n\
37
+ \n\
38
+ # Set VNC password\n\
39
+ export VNC_PASSWD=${VNC_PASSWD:-password}\n\
40
+ \n\
41
+ # Start Xvfb (Virtual Monitor)\n\
42
+ Xvfb :1 -screen 0 1280x720x16 &\n\
43
+ export DISPLAY=:1\n\
44
+ sleep 2\n\
45
+ \n\
46
+ # Start Window Manager (XFCE)\n\
47
+ startxfce4 &\n\
48
+ sleep 2\n\
49
+ \n\
50
+ # Start VNC Server\n\
51
+ mkdir -p ~/.vnc\n\
52
+ x11vnc -storepasswd "$VNC_PASSWD" ~/.vnc/passwd\n\
53
+ x11vnc -display :1 -rfbauth ~/.vnc/passwd -forever -shared -bg\n\
54
+ \n\
55
+ # Start NoVNC (The Web Interface)\n\
56
+ # In Debian Bookworm, novnc is located at /usr/share/novnc\n\
57
+ websockify --web /usr/share/novnc/ 7860 localhost:5900\n\
58
+ ' > start.sh
59
+
60
  RUN chmod +x start.sh
61
 
62
  # 5. Expose the Hugging Face port