codelab / Dockerfile
ductotaha's picture
Update Dockerfile
75f209c verified
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", "--" ]