mn9206986 commited on
Commit
be5a348
·
verified ·
1 Parent(s): 76c601b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +49 -56
Dockerfile CHANGED
@@ -1,56 +1,49 @@
1
- FROM debian:bookworm
2
- LABEL description="Chrome With noVNC" \
3
- maintainer="admin@fever.ink" \
4
- version="2.5"
5
-
6
- # Cài Chrome
7
- RUN \
8
- apt update && \
9
- apt upgrade -y && \
10
- apt install --no-install-recommends -y wget fonts-droid-fallback && \
11
- wget --no-check-certificate https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -O /tmp/google-chrome-stable_current_amd64.deb && \
12
- apt install --no-install-recommends -f -y /tmp/google-chrome-stable_current_amd64.deb && \
13
- rm /tmp/google-chrome-stable_current_amd64.deb
14
-
15
- # Cài VNC server và noVNC
16
- RUN \
17
- apt install --no-install-recommends -y tightvncserver xfonts-base git websockify python3 net-tools procps && \
18
- git clone https://github.com/novnc/noVNC.git /opt/novnc
19
-
20
- # Tạo thư mục và file với quyền phù hợp
21
- RUN \
22
- mkdir -p /config/google-chrome /config/.vnc && \
23
- touch /config/google-chrome/First\ Run /config/.vnc/passwd /config/.vnc/xstartup && \
24
- echo "Binhminh" | vncpasswd -f > /config/.vnc/passwd && \
25
- echo "#!/bin/sh\nunset SESSION_MANAGER\nunset DBUS_SESSION_BUS_ADDRESS\nwhile [ 1 ]; do /opt/google/chrome/google-chrome --test-type --window-size=$((WIDTH+1)),$((HEIGHT+1)) --no-sandbox --window-position=0,0 --user-data-dir=/config/google-chrome; done" > /config/.vnc/xstartup && \
26
- chmod -R 777 /config /opt/novnc && \
27
- chmod 600 /config/.vnc/passwd && \
28
- chmod 700 /config/.vnc/xstartup
29
-
30
- # Copy cấu hình chrome-novnc.sh
31
- COPY chrome-novnc.sh /usr/bin/chrome-novnc.sh
32
- RUN \
33
- ln -s /opt/novnc/vnc.html /opt/novnc/index.html && \
34
- chmod +x /usr/bin/chrome-novnc.sh
35
-
36
- # Biến môi trường
37
- ENV \
38
- WIDTH=1280 \
39
- HEIGHT=720 \
40
- LANGUAGE=zh_CN.UTF-8 \
41
- VNC_PASSWD=Binhminh \
42
- HOME=/config \
43
- XDG_CONFIG_HOME=/config \
44
- VNC_DIR=/config/.vnc
45
-
46
- EXPOSE 7860
47
-
48
- VOLUME /config
49
-
50
- # Dọn dẹp
51
- RUN \
52
- apt purge -y git && \
53
- apt autoremove --purge -y && \
54
- rm -rf /var/lib/apt/lists/*
55
-
56
- CMD ["bash", "-c", "/usr/bin/chrome-novnc.sh"]
 
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
+
12
+ # Install dependencies: Chrome, Xvfb, noVNC, Fluxbox, and utilities
13
+ RUN apt-get update && apt-get install -y \
14
+ wget \
15
+ gnupg \
16
+ xvfb \
17
+ fluxbox \
18
+ x11vnc \
19
+ novnc \
20
+ curl \
21
+ && rm -rf /var/lib/apt/lists/*
22
+
23
+ # Install Google Chrome
24
+ RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
25
+ && echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
26
+ && apt-get update \
27
+ && apt-get install -y google-chrome-stable \
28
+ && rm -rf /var/lib/apt/lists/*
29
+
30
+ # Create a non-root user
31
+ RUN useradd -m -s /bin/bash $USER
32
+
33
+ # Set up noVNC web interface
34
+ RUN ln -s /usr/share/novnc/vnc.html /usr/share/novnc/index.html
35
+
36
+ # Copy a startup script to run Chrome in VNC
37
+ RUN mkdir -p $HOME/scripts
38
+ COPY start.sh $HOME/scripts/start.sh
39
+ RUN chmod +x $HOME/scripts/start.sh
40
+
41
+ # Switch to non-root user
42
+ USER $USER
43
+ WORKDIR $HOME
44
+
45
+ # Expose port 7860 for noVNC (Hugging Face Spaces default)
46
+ EXPOSE $NOVNC_PORT
47
+
48
+ # Start the VNC server, noVNC, and Chrome
49
+ CMD ["/home/appuser/scripts/start.sh"]