mathematica / Dockerfile
georgesnoe's picture
Update Dockerfile
855a7a1 verified
# ============================================================
# Hugging Face Space — Linux Desktop (XFCE) via noVNC
# Base: Ubuntu 24.04 + XFCE4 + Xvnc direct + noVNC
# Access: http://your-space.hf.space (port 7860)
# ============================================================
FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive
ENV HOME=/home/georgesnoe
ENV DISPLAY=:1
# ── System dependencies ──────────────────────────────────────
RUN apt-get update && apt-get install -y \
# Desktop environment
xfce4 \
xfce4-terminal \
xfce4-taskmanager \
xfce4-screenshooter \
thunar \
# VNC (Xvnc binary is in tigervnc-standalone-server)
tigervnc-standalone-server \
tigervnc-common \
# noVNC
novnc \
websockify \
# Browser
firefox \
# Utilities
wget \
curl \
git \
unzip \
sudo \
dbus-x11 \
xfonts-base \
xfonts-100dpi \
xfonts-75dpi \
fonts-liberation \
fonts-dejavu-core \
&& curl -fsSL https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb \
-o /tmp/cloudflared.deb \
&& dpkg -i /tmp/cloudflared.deb \
&& rm /tmp/cloudflared.deb \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# ── Create non-root user ──────────────────────────────────────
RUN useradd -m -s /bin/bash georgesnoe \
&& echo "georgesnoe:georgesnoe" | chpasswd \
&& usermod -aG sudo georgesnoe \
&& echo "georgesnoe ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
# ── VNC dirs & xstartup ───────────────────────────────────────
RUN mkdir -p /home/georgesnoe/.vnc
COPY xstartup /home/georgesnoe/.vnc/xstartup
RUN chmod +x /home/georgesnoe/.vnc/xstartup \
&& chown -R georgesnoe:georgesnoe /home/georgesnoe/.vnc
# ── noVNC symlink ─────────────────────────────────────────────
RUN ln -sf /usr/share/novnc/vnc.html /usr/share/novnc/index.html
# ── Entrypoint ────────────────────────────────────────────────
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
# ── Expose noVNC port (HF requires 7860) ──────────────────────
EXPOSE 7860
CMD ["/entrypoint.sh"]