veltrixcode commited on
Commit
9172f7a
·
verified ·
1 Parent(s): 1a2d1e9

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +48 -45
Dockerfile CHANGED
@@ -1,65 +1,68 @@
1
  FROM ubuntu:22.04
2
 
3
  ENV DEBIAN_FRONTEND=noninteractive
4
- ENV DISPLAY=:0
5
 
6
- # Install base packages
 
 
7
  RUN apt-get update && apt-get install -y \
8
- sudo wget curl unzip nano \
9
- xfce4 xfce4-goodies xfce4-terminal \
10
- x11vnc xvfb \
11
  novnc websockify \
12
- dbus-x11 \
 
 
13
  && apt-get clean
14
 
15
- # Disable unneeded XFCE autostart apps (remove warnings)
16
- RUN rm -f /etc/xdg/autostart/xfce4-power-manager.desktop \
17
- && rm -f /etc/xdg/autostart/at-spi-dbus-bus.desktop
 
18
 
19
- # Create non-root user
 
 
20
  RUN useradd -m -s /bin/bash user && \
21
- echo "user:user" | chpasswd && adduser user sudo
 
22
 
23
  USER user
24
  WORKDIR /home/user
25
 
26
- # VNC passwordless
27
- RUN mkdir -p ~/.vnc && \
28
- x11vnc -storepasswd '' ~/.vnc/passwd
 
29
 
30
- ############################################
31
- # 👉 Install OFFICIAL VS CODE SERVER
32
- ############################################
33
 
34
- # Download VS Code Server installer
35
- RUN curl -fsSL https://code.visualstudio.com/sha/download?build=stable&os=cli-alpine-x64 \
36
- -o vscode-cli.tar.gz && \
37
- mkdir -p ~/.vscode-server/bin && \
38
- tar -xf vscode-cli.tar.gz -C ~/.vscode-server/bin --strip-components=1 && \
39
- rm vscode-cli.tar.gz
40
 
41
- # VS Code Server binary shortcut
42
- RUN echo 'export PATH=$PATH:/home/user/.vscode-server/bin' >> ~/.bashrc
43
 
44
- ############################################
 
45
 
46
- # EXPOSE ports
47
- EXPOSE 7860 # Desktop via noVNC
48
- EXPOSE 9000 # VS Code Server
49
 
50
- ############################################
51
- # Startup Script (runs BOTH desktop + vscode)
52
- ############################################
53
- CMD bash -c '\
54
- # Start virtual display \
55
- Xvfb :0 -screen 0 1280x720x16 & \
56
- sleep 1; \
57
- export DISPLAY=:0; \
58
- dbus-launch startxfce4 & \
59
- # Start VNC \
60
- x11vnc -display :0 -rfbport 5900 -passwd "" -forever & \
61
- # noVNC on port 7860 \
62
- websockify --web=/usr/share/novnc/ 7860 localhost:5900 & \
63
- # Start VS Code Server on port 9000 \
64
- ~/.vscode-server/bin/code-server --bind-addr 0.0.0.0:9000 --auth none \
65
- '
 
1
  FROM ubuntu:22.04
2
 
3
  ENV DEBIAN_FRONTEND=noninteractive
 
4
 
5
+ # -------------------------------------------------------
6
+ # Install base system + desktop environment + tools
7
+ # -------------------------------------------------------
8
  RUN apt-get update && apt-get install -y \
9
+ xfce4 xfce4-goodies \
10
+ tigervnc-standalone-server \
11
+ dbus-x11 x11-xserver-utils \
12
  novnc websockify \
13
+ curl wget git nano \
14
+ python3 python3-pip \
15
+ sudo \
16
  && apt-get clean
17
 
18
+ # -------------------------------------------------------
19
+ # Install VS Code Server
20
+ # -------------------------------------------------------
21
+ RUN curl -fsSL https://code-server.dev/install.sh | sh
22
 
23
+ # -------------------------------------------------------
24
+ # Create user
25
+ # -------------------------------------------------------
26
  RUN useradd -m -s /bin/bash user && \
27
+ echo "user:user" | chpasswd && \
28
+ adduser user sudo
29
 
30
  USER user
31
  WORKDIR /home/user
32
 
33
+ # -------------------------------------------------------
34
+ # Create startup script (no external file needed)
35
+ # -------------------------------------------------------
36
+ RUN mkdir -p ~/.vnc
37
 
38
+ RUN echo "#!/bin/bash
39
+ export DISPLAY=:1
40
+ export USER=user
41
 
42
+ # Start VNC
43
+ tigervncserver :1 -geometry 1280x720 -depth 24
 
 
 
 
44
 
45
+ # Start noVNC
46
+ websockify --web=/usr/share/novnc 0.0.0.0:7860 localhost:5901 &
47
 
48
+ # Start VS Code Server
49
+ code-server --bind-addr 0.0.0.0:9000 --auth none &
50
 
51
+ # Keep container alive
52
+ sleep infinity
53
+ " > /home/user/start.sh && chmod +x /home/user/start.sh
54
 
55
+ # -------------------------------------------------------
56
+ # Expose ports
57
+ # -------------------------------------------------------
58
+
59
+ # Desktop UI (noVNC)
60
+ EXPOSE 7860
61
+
62
+ # VS Code Server
63
+ EXPOSE 9000
64
+
65
+ # -------------------------------------------------------
66
+ # Start everything
67
+ # -------------------------------------------------------
68
+ CMD ["/home/user/start.sh"]