File size: 1,720 Bytes
bcb86b5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e9861d4
 
bcb86b5
 
 
7a49512
bcb86b5
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
FROM debian:bullseye-slim

# Prevent interactive prompts
ENV DEBIAN_FRONTEND=noninteractive
ENV DISPLAY=:1
ENV VNC_PORT=5901
ENV NO_VNC_PORT=6080
ENV VNC_PASSWORD=vncpassword

# Install minimal dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
    # Window Manager
    openbox \
    # VNC
    tigervnc-standalone-server \
    tigervnc-common \
    novnc \
    websockify \
    # Browser
    firefox-esr \
    # Python
    python3 \
    python3-pip \
    python3-venv \
    # Tools
    xdotool \
    scrot \
    procps \
    curl \
    ca-certificates \
    # Cleanup
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Create user
RUN useradd -m -s /bin/bash vncuser && \
    mkdir -p /home/vncuser/.vnc && \
    chown -R vncuser:vncuser /home/vncuser

# Set VNC password
USER vncuser
RUN echo "${VNC_PASSWORD}" | vncpasswd -f > /home/vncuser/.vnc/passwd && \
    chmod 600 /home/vncuser/.vnc/passwd

# Configure Openbox
RUN mkdir -p /home/vncuser/.config/openbox

# VNC Startup Script
RUN echo '#!/bin/bash' > /home/vncuser/.vnc/xstartup && \
    echo 'exec openbox-session' >> /home/vncuser/.vnc/xstartup && \
    chmod +x /home/vncuser/.vnc/xstartup

USER root

# Python dependencies
COPY requirements.txt /tmp/requirements.txt
RUN pip3 install --no-cache-dir --upgrade pip && \
    pip3 install --no-cache-dir -r /tmp/requirements.txt

# App Setup
WORKDIR /app
COPY . /app
RUN mkdir -p /app/scripts /app/agent /app/logs && \
    chown -R vncuser:vncuser /app

# Copy scripts
COPY scripts/start-desktop.sh /app/scripts/start-desktop.sh
RUN chmod +x /app/scripts/start-desktop.sh

# Expose ports
EXPOSE ${VNC_PORT} ${NO_VNC_PORT} 7860 8000

CMD ["/app/scripts/start-desktop.sh"]