File size: 1,512 Bytes
84e91b3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive

# HF Spaces requirements
ENV HF_HOME=/tmp/huggingface
ENV GRADIO_SERVER_NAME=0.0.0.0
ENV GRADIO_SERVER_PORT=7860

# 1) Install Xfce, x11vnc, Xvfb, xdotool, etc.
RUN apt-get update && apt-get install -y \
    xfce4 \
    xfce4-goodies \
    x11vnc \
    xvfb \
    xdotool \
    imagemagick \
    x11-apps \
    sudo \
    software-properties-common \
    python3 \
    python3-pip \
    curl \
    wget \
    scrot \
    novnc \
    websockify \
    net-tools \
 && apt-get remove -y light-locker xfce4-screensaver xfce4-power-manager || true \
 && apt-get clean && rm -rf /var/lib/apt/lists/*

# 2) Add the mozillateam PPA and install Firefox ESR
RUN add-apt-repository ppa:mozillateam/ppa \
 && apt-get update \
 && apt-get install -y --no-install-recommends firefox-esr \
 && update-alternatives --set x-www-browser /usr/bin/firefox-esr \
 && apt-get clean && rm -rf /var/lib/apt/lists/*

# 3) Create non-root user (HF Spaces requirement)
RUN useradd -m -u 1000 user
ENV HOME=/home/user
WORKDIR /home/user/app

# 4) Install Python dependencies
COPY --chown=user requirements.txt .
RUN pip3 install --no-cache-dir -r requirements.txt

# 5) Copy application code
COPY --chown=user . /home/user/app

# 6) Setup noVNC for web-based VNC
RUN ln -s /usr/share/novnc/vnc.html /usr/share/novnc/index.html

# 7) Make start script executable
RUN chmod +x /home/user/app/start.sh

USER user

# Expose port 7860 for Gradio
EXPOSE 7860

CMD ["/home/user/app/start.sh"]