FROM ubuntu:focal ENV DEBIAN_FRONTEND=noninteractive # Update package lists and upgrade existing packages RUN apt-get update && apt-get upgrade -y # Install necessary packages RUN apt-get install -y \ curl \ neofetch \ ffmpeg \ imagemagick \ git \ git-lfs \ nodejs \ npm \ software-properties-common \ python3 \ python3-pip \ python3-venv \ build-essential \ libvips \ libvips-dev \ libjpeg-dev \ libpng-dev \ chromium-browser \ libgbm-dev \ xvfb # Install speedtest-cli using pip RUN pip install --no-cache-dir speedtest-cli # Install the latest version of Node.js using n RUN npm install -g n && n latest # Update npm to the latest version RUN npm install -g npm@latest # Clear npm cache RUN npm cache clean --force # Manually delete npm cache folder RUN rm -rf /root/.npm # Install Puppeteer RUN mkdir -p /home/nex/app && cd /home/nex/app && npm init -y && npm install puppeteer # Create a non-root user RUN useradd -m -u 1000 nex # Change ownership of the home directory to the non-root user RUN chown -R nex:nex /home/nex # Install code-server RUN curl -fsSL https://code-server.dev/install.sh | sh # Set up Python virtual environment RUN python3 -m venv /venv ENV PATH="/venv/bin:$PATH" # Switch to non-root user USER nex # Set environment variables ENV HOME=/home/nex \ PATH=/home/nex/.local/bin:$PATH # Set the working directory WORKDIR $HOME # Copy the application code COPY --chown=nex . $HOME/server # Start code-server CMD ["code-server", ".", "--bind-addr", "0.0.0.0:7860", "--auth", "none"]