File size: 4,178 Bytes
98d8366
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75f209c
98d8366
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
FROM gitpod/openvscode-server:latest

USER root

# Install sudo, apt-utils, and nano
RUN apt-get update -y > /dev/null 2>&1 &&  \
    apt-get upgrade -y > /dev/null 2>&1 &&  \
    apt-get install -y sudo apt-utils nano > /dev/null 2>&1 && \
    apt-get install -y python3-pip > /dev/null 2>&1 &&  \
    pip3 install --upgrade pip > /dev/null 2>&1
RUN apt install python3.10-venv -y
RUN apt-get install -y curl gnupg wget htop sudo git git-lfs software-properties-common build-essential libgl1 zip unzip > /dev/null 2>&1

RUN add-apt-repository ppa:flexiondotorg/nvtop > /dev/null 2>&1
RUN apt-get upgrade -y > /dev/null 2>&1
RUN apt-get install -y nvtop > /dev/null 2>&1

RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
RUN sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
RUN apt update && apt install google-chrome-stable -y
RUN google-chrome --version

RUN sudo apt install ubuntu-desktop
RUN sudo apt install xserver-xorg-video-dummy
RUN sudo apt install lightdm

RUN wget https://github.com/rustdesk/rustdesk/releases/download/1.1.8/rustdesk-1.1.8.deb
RUN sudo apt install ./rustdesk-1.1.8.deb -y 

RUN sudo rustdesk --get-id
RUN sudo rustdesk --password 123456
RUN sudo rustdesk --option allow-linux-headless Y


# Add openvscode-server user to sudoers and grant passwordless sudo
#RUN adduser openvscode-server
RUN echo "openvscode-server ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers.d/openvscode-server && \
    chmod 0440 /etc/sudoers.d/openvscode-server

# Set ownership and permissions
RUN chown -R openvscode-server:openvscode-server /var/lib/apt/lists && \
    chmod -R 755 /var/lib/apt/lists

RUN chown -R openvscode-server:openvscode-server /var/cache/apt/archives/partial && \
    chmod -R 755 /var/cache/apt/archives/partial

# Find and set permissions, ignoring errors
RUN find / -type d -exec chown -R openvscode-server:openvscode-server {} +  > /dev/null 2>&1 || true > /dev/null 2>&1
RUN find / -type d -exec chmod -R 755 {} +  > /dev/null 2>&1 || true > /dev/null 2>&1
RUN find / -type f -exec chown openvscode-server:openvscode-server {} +  > /dev/null 2>&1 || true > /dev/null 2>&1
RUN find / -type f -exec chmod 777 {} +  > /dev/null 2>&1 || true > /dev/null 2>&1

# Fix permissions for /etc/sudo.conf
RUN chmod 644 /etc/sudo.conf

# Disable the "no new privileges" flag for sudo
RUN echo 'Defaults !attach_warning' > /etc/sudo.conf

# Ensure sudoers.so has the correct ownership
RUN chown root:root /usr/lib/sudo/sudoers.so  || true && \
    chmod 644 /usr/lib/sudo/sudoers.so || true

# Set the root password (replace 'your_password' with your desired password)
RUN echo "root:your_password" | chpasswd

RUN touch ~/.bashrc || true
RUN curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash  > /dev/null 2>&1
RUN apt install nodejs -y
RUN apt install npm -y

RUN npm install -g tunnelmole > /dev/null 2>&1

# Install PHP, Apache, and MySQL
RUN DEBIAN_FRONTEND="noninteractive" apt-get -y install apache2 mysql-server php libapache2-mod-php php-mysql > /dev/null 2>&1

# PHP extensions and tools
RUN apt-get install -y php-mbstring php-xml composer > /dev/null 2>&1


# Find and set permissions, ignoring errors
RUN find /home/ -type d -exec chown -R openvscode-server:openvscode-server {} +  > /dev/null 2>&1 || true > /dev/null 2>&1
RUN find /home/ -type d -exec chmod -R 755 {} +  > /dev/null 2>&1 || true > /dev/null 2>&1
RUN find /home/ -type f -exec chown openvscode-server:openvscode-server {} +  > /dev/null 2>&1 || true > /dev/null 2>&1
RUN find /home/ -type f -exec chmod 777 {} +  > /dev/null 2>&1 || true > /dev/null 2>&1


RUN pip install selenium
RUN pip install webdriver-manager
RUN pip install undetected-chromedriver

USER openvscode-server

EXPOSE 7860

ENTRYPOINT [ "/bin/sh", "-c", "exec ${OPENVSCODE_SERVER_ROOT}/bin/openvscode-server --host 0.0.0.0 --port 7860 --connection-token ${VS_ACCESS} \"${@}\"", "--" ]


#ENTRYPOINT [ "/bin/sh", "-c", "exec ${OPENVSCODE_SERVER_ROOT}/bin/openvscode-server --host 0.0.0.0 --port 7860 --without-connection-token \"${@}\"; tmole 7860", "--" ]