parano / Dockerfile
vish85521's picture
Update Dockerfile
7835d1e verified
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
# 1. Create a non-root user (Hugging Face strictly requires user ID 1000)
RUN useradd -m -u 1000 user
ENV HOME=/home/user
ENV PATH=/home/user/.local/bin:$PATH
# 2. Install desktop, VNC, and web access
RUN apt-get update && apt-get install -y \
xfce4 xfce4-goodies \
x11vnc xvfb \
novnc websockify \
wget curl git \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# 3. Bulletproof Health Check Fix
# We create a custom index.html that gives Hugging Face a "200 OK" health status,
# while instantly redirecting your browser to the actual VNC page.
RUN echo '<meta http-equiv="refresh" content="0; url=vnc.html">' > /usr/share/novnc/index.html
WORKDIR $HOME
# 4. Set VNC password and fix permissions for the user
RUN mkdir -p $HOME/.vnc && \
x11vnc -storepasswd 1234 $HOME/.vnc/passwd && \
chown -R user:user $HOME
# 5. Switch to the Hugging Face required user
USER user
# 6. Expose web port
EXPOSE 7860
# 7. Start everything (Removed the failing DPMS command)
CMD bash -c "\
Xvfb :0 -screen 0 1024x768x24 & \
sleep 2 && \
export DISPLAY=:0 && \
startxfce4 & \
x11vnc -display :0 -usepw -forever -rfbport 5900 & \
websockify --web=/usr/share/novnc/ 7860 localhost:5900 \
"