binary1ne commited on
Commit
a86238d
·
verified ·
1 Parent(s): f3aa631

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +60 -0
Dockerfile ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use Ubuntu 22.04 as the base image for compatibility and minimal size
2
+ FROM ubuntu:22.04
3
+
4
+ # Set environment variables for non-interactive installation
5
+ ENV DEBIAN_FRONTEND=noninteractive
6
+ ENV USER=appuser
7
+ ENV HOME=/home/$USER
8
+ ENV DISPLAY=:1
9
+ ENV VNC_PORT=5901
10
+ ENV NOVNC_PORT=7860
11
+ ENV X11VNC_LOG=/tmp/x11vnc.log
12
+
13
+ # Install dependencies: Chrome, Xvfb, noVNC, Fluxbox, and utilities
14
+ RUN apt-get update && apt-get install -y \
15
+ wget \
16
+ gnupg \
17
+ xvfb \
18
+ fluxbox \
19
+ x11vnc \
20
+ novnc \
21
+ curl \
22
+ && rm -rf /var/lib/apt/lists/*
23
+
24
+ # Install Google Chrome
25
+ RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
26
+ && echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
27
+ && apt-get update \
28
+ && apt-get install -y google-chrome-stable \
29
+ && rm -rf /var/lib/apt/lists/*
30
+
31
+ # Create a non-root user
32
+ RUN useradd -m -s /bin/bash $USER
33
+
34
+ # Fix permissions for X11 socket directory
35
+ RUN mkdir -p /tmp/.X11-unix \
36
+ && chmod 1777 /tmp/.X11-unix \
37
+ && chown $USER:$USER /tmp/.X11-unix
38
+
39
+ # Create a minimal Fluxbox config to suppress warnings
40
+ RUN mkdir -p $HOME/.fluxbox
41
+ COPY fluxbox_menu $HOME/.fluxbox/menu
42
+ RUN chown -R $USER:$USER $HOME/.fluxbox
43
+
44
+ # Set up noVNC web interface
45
+ RUN ln -s /usr/share/novnc/vnc.html /usr/share/novnc/index.html
46
+
47
+ # Copy a startup script to run Chrome in VNC
48
+ RUN mkdir -p $HOME/scripts
49
+ COPY start.sh $HOME/scripts/start.sh
50
+ RUN chmod +x $HOME/scripts/start.sh
51
+
52
+ # Switch to non-root user
53
+ USER $USER
54
+ WORKDIR $HOME
55
+
56
+ # Expose port 7860 for noVNC (Hugging Face Spaces default)
57
+ EXPOSE $NOVNC_PORT
58
+
59
+ # Start the VNC server, noVNC, and Chrome
60
+ CMD ["/home/appuser/scripts/start.sh"]