georgesnoe commited on
Commit
599252b
·
verified ·
1 Parent(s): bcb7498

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -28
Dockerfile CHANGED
@@ -1,20 +1,14 @@
1
  # ============================================================
2
  # Hugging Face Space — Linux Desktop (XFCE) via noVNC
3
- # Base: Ubuntu 24.04 + XFCE4 + noVNC
4
  # Access: http://your-space.hf.space (port 7860)
5
  # ============================================================
6
 
7
  FROM ubuntu:24.04
8
 
9
  ENV DEBIAN_FRONTEND=noninteractive
10
- ENV USER=user
11
  ENV HOME=/home/user
12
  ENV DISPLAY=:1
13
- ENV VNC_PORT=5901
14
- ENV NOVNC_PORT=7860
15
- ENV VNC_RESOLUTION=1280x800
16
- ENV VNC_COL_DEPTH=24
17
- ENV VNC_PW=hfdesktop
18
 
19
  # ── System dependencies ──────────────────────────────────────
20
  RUN apt-get update && apt-get install -y \
@@ -24,9 +18,10 @@ RUN apt-get update && apt-get install -y \
24
  xfce4-taskmanager \
25
  xfce4-screenshooter \
26
  thunar \
27
- # VNC + noVNC
28
  tigervnc-standalone-server \
29
  tigervnc-common \
 
30
  novnc \
31
  websockify \
32
  # Browser
@@ -36,7 +31,7 @@ RUN apt-get update && apt-get install -y \
36
  curl \
37
  git \
38
  unzip \
39
- supervisor \
40
  dbus-x11 \
41
  xfonts-base \
42
  xfonts-100dpi \
@@ -49,31 +44,23 @@ RUN apt-get update && apt-get install -y \
49
  # ── Create non-root user ──────────────────────────────────────
50
  RUN useradd -m -s /bin/bash user \
51
  && echo "user:user" | chpasswd \
52
- && usermod -aG sudo user
 
53
 
54
- # ── VNC password setup ───────────────────────────────────────
55
- RUN mkdir -p /home/user/.vnc \
56
- && echo "${VNC_PW}" | vncpasswd -f > /home/user/.vnc/passwd \
57
- && chmod 600 /home/user/.vnc/passwd \
58
  && chown -R user:user /home/user/.vnc
59
 
60
- # ── XFCE startup script ───────────────────────────────────────
61
- RUN printf '#!/bin/bash\nexport DISPLAY=:1\neval $(dbus-launch --sh-syntax)\nstartxfce4 &\n' \
62
- > /home/user/.vnc/xstartup \
63
- && chmod +x /home/user/.vnc/xstartup \
64
- && chown user:user /home/user/.vnc/xstartup
65
-
66
  # ── noVNC symlink ─────────────────────────────────────────────
67
- RUN ln -s /usr/share/novnc/vnc.html /usr/share/novnc/index.html 2>/dev/null || true
68
-
69
- # ── Supervisor config ─────────────────────────────────────────
70
- COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
71
 
72
- # ── Permissions ───────────────────────────────────────────────
73
- RUN chown -R user:user /home/user
 
74
 
75
  # ── Expose noVNC port (HF requires 7860) ──────────────────────
76
  EXPOSE 7860
77
 
78
- # ── Entrypoint ────────────────────────────────────────────────
79
- CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
 
1
  # ============================================================
2
  # Hugging Face Space — Linux Desktop (XFCE) via noVNC
3
+ # Base: Ubuntu 24.04 + XFCE4 + Xvnc direct + noVNC
4
  # Access: http://your-space.hf.space (port 7860)
5
  # ============================================================
6
 
7
  FROM ubuntu:24.04
8
 
9
  ENV DEBIAN_FRONTEND=noninteractive
 
10
  ENV HOME=/home/user
11
  ENV DISPLAY=:1
 
 
 
 
 
12
 
13
  # ── System dependencies ──────────────────────────────────────
14
  RUN apt-get update && apt-get install -y \
 
18
  xfce4-taskmanager \
19
  xfce4-screenshooter \
20
  thunar \
21
+ # VNC (Xvnc binary is in tigervnc-standalone-server)
22
  tigervnc-standalone-server \
23
  tigervnc-common \
24
+ # noVNC
25
  novnc \
26
  websockify \
27
  # Browser
 
31
  curl \
32
  git \
33
  unzip \
34
+ sudo \
35
  dbus-x11 \
36
  xfonts-base \
37
  xfonts-100dpi \
 
44
  # ── Create non-root user ──────────────────────────────────────
45
  RUN useradd -m -s /bin/bash user \
46
  && echo "user:user" | chpasswd \
47
+ && usermod -aG sudo user \
48
+ && echo "user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
49
 
50
+ # ── VNC dirs & xstartup ───────────────────────────────────────
51
+ RUN mkdir -p /home/user/.vnc
52
+ COPY xstartup /home/user/.vnc/xstartup
53
+ RUN chmod +x /home/user/.vnc/xstartup \
54
  && chown -R user:user /home/user/.vnc
55
 
 
 
 
 
 
 
56
  # ── noVNC symlink ─────────────────────────────────────────────
57
+ RUN ln -sf /usr/share/novnc/vnc.html /usr/share/novnc/index.html
 
 
 
58
 
59
+ # ── Entrypoint ───────────────────────────────────────────────
60
+ COPY entrypoint.sh /entrypoint.sh
61
+ RUN chmod +x /entrypoint.sh
62
 
63
  # ── Expose noVNC port (HF requires 7860) ──────────────────────
64
  EXPOSE 7860
65
 
66
+ CMD ["/entrypoint.sh"]