FROM codercom/code-server:latest USER root # Update system and install required dependencies RUN apt-get update && apt-get upgrade -y # Install Node.js RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \ apt-get install -y nodejs # Install Python 3.x and venv RUN apt-get install -y python3 python3-venv # Set up a virtual environment for Python RUN python3 -m venv /home/coder/venv && \ /home/coder/venv/bin/pip install --upgrade pip # Install dependencies for Playwright RUN apt-get install -y \ libx11-xcb1 \ libxcb-shm0 \ libxrandr2 \ libxcomposite1 \ libxcursor1 \ libxdamage1 \ libxfixes3 \ libxi6 \ libgtk-3-0 \ libgdk-pixbuf2.0-0 \ libpangocairo-1.0-0 \ libpango-1.0-0 \ libatk1.0-0 \ libcairo-gobject2 \ libcairo2 \ libasound2 \ libxrender1 \ libdbus-1-3 # Install Java RUN wget https://download.java.net/openjdk/jdk20/ri/openjdk-20+36_linux-x64_bin.tar.gz && \ mkdir -p /usr/lib/jvm && \ tar zxvf openjdk-20+36_linux-x64_bin.tar.gz -C /usr/lib/jvm && \ rm openjdk-20+36_linux-x64_bin.tar.gz && \ update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk-20/bin/java" 1 && \ update-alternatives --set java /usr/lib/jvm/jdk-20/bin/java # Download and configure fixuid to avoid permission issues RUN curl -L https://github.com/boxboat/fixuid/releases/download/v0.5/fixuid -o /usr/local/bin/fixuid && \ chown root:root /usr/local/bin/fixuid && \ chmod 4755 /usr/local/bin/fixuid && \ mkdir -p /etc/fixuid && \ printf "user: coder\ngroup: coder\n" > /etc/fixuid/config.yml # Create necessary directories RUN mkdir -p /home/coder/.config && \ mkdir -p /home/coder/.local/share/code-server/User && \ chmod -R 777 /home/coder/ WORKDIR /home/coder/project # Set volumes VOLUME ["/home/coder/.local", "/home/coder/.config", "/home/coder/project"] # Expose the default port for code-server EXPOSE 8080 # Set the environment variable for the Docker user ENV DOCKER_USER=${USER} # Switch to coder user RUN id -u coder &>/dev/null || useradd -ms /bin/bash coder USER coder # Activate the virtual environment and start code-server CMD ["fixuid", "/home/coder/venv/bin/code-server", "--auth", "none", "--host", "0.0.0.0"]