Upload Dockerfile with huggingface_hub
Browse files- Dockerfile +61 -0
Dockerfile
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM ubuntu:22.04
|
| 2 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 3 |
+
|
| 4 |
+
# HF Spaces requirements
|
| 5 |
+
ENV HF_HOME=/tmp/huggingface
|
| 6 |
+
ENV GRADIO_SERVER_NAME=0.0.0.0
|
| 7 |
+
ENV GRADIO_SERVER_PORT=7860
|
| 8 |
+
|
| 9 |
+
# 1) Install Xfce, x11vnc, Xvfb, xdotool, etc.
|
| 10 |
+
RUN apt-get update && apt-get install -y \
|
| 11 |
+
xfce4 \
|
| 12 |
+
xfce4-goodies \
|
| 13 |
+
x11vnc \
|
| 14 |
+
xvfb \
|
| 15 |
+
xdotool \
|
| 16 |
+
imagemagick \
|
| 17 |
+
x11-apps \
|
| 18 |
+
sudo \
|
| 19 |
+
software-properties-common \
|
| 20 |
+
python3 \
|
| 21 |
+
python3-pip \
|
| 22 |
+
curl \
|
| 23 |
+
wget \
|
| 24 |
+
scrot \
|
| 25 |
+
novnc \
|
| 26 |
+
websockify \
|
| 27 |
+
net-tools \
|
| 28 |
+
&& apt-get remove -y light-locker xfce4-screensaver xfce4-power-manager || true \
|
| 29 |
+
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 30 |
+
|
| 31 |
+
# 2) Add the mozillateam PPA and install Firefox ESR
|
| 32 |
+
RUN add-apt-repository ppa:mozillateam/ppa \
|
| 33 |
+
&& apt-get update \
|
| 34 |
+
&& apt-get install -y --no-install-recommends firefox-esr \
|
| 35 |
+
&& update-alternatives --set x-www-browser /usr/bin/firefox-esr \
|
| 36 |
+
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 37 |
+
|
| 38 |
+
# 3) Create non-root user (HF Spaces requirement)
|
| 39 |
+
RUN useradd -m -u 1000 user
|
| 40 |
+
ENV HOME=/home/user
|
| 41 |
+
WORKDIR /home/user/app
|
| 42 |
+
|
| 43 |
+
# 4) Install Python dependencies
|
| 44 |
+
COPY --chown=user requirements.txt .
|
| 45 |
+
RUN pip3 install --no-cache-dir -r requirements.txt
|
| 46 |
+
|
| 47 |
+
# 5) Copy application code
|
| 48 |
+
COPY --chown=user . /home/user/app
|
| 49 |
+
|
| 50 |
+
# 6) Setup noVNC for web-based VNC
|
| 51 |
+
RUN ln -s /usr/share/novnc/vnc.html /usr/share/novnc/index.html
|
| 52 |
+
|
| 53 |
+
# 7) Make start script executable
|
| 54 |
+
RUN chmod +x /home/user/app/start.sh
|
| 55 |
+
|
| 56 |
+
USER user
|
| 57 |
+
|
| 58 |
+
# Expose port 7860 for Gradio
|
| 59 |
+
EXPOSE 7860
|
| 60 |
+
|
| 61 |
+
CMD ["/home/user/app/start.sh"]
|