Spaces:
Sleeping
Sleeping
Create Dockerfile
Browse files- Dockerfile +65 -0
Dockerfile
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
'
|