# Use Python 3.9 as the base image FROM python:3.9 # Set environment variables ENV DEBIAN_FRONTEND=noninteractive # Install necessary packages RUN apt-get update && \ apt-get install -y \ curl \ sudo \ build-essential \ default-jdk \ default-jre \ g++ \ gcc # Install code-server RUN curl -fsSL https://code-server.dev/install.sh | sh # Create a user to run code-server RUN useradd -m -s /bin/bash coder && \ echo 'coder ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers # Create and set the working directory RUN mkdir -p /home/coder/genz WORKDIR /home/coder/genz # Change ownership of the working directory RUN chown -R coder:coder /home/coder/genz # Create code-server configuration directory RUN mkdir -p /home/coder/.config/code-server # Add settings.json to enable dark mode and disable telemetry RUN echo '{ \ "workbench.colorTheme": "Default Dark+", \ "telemetry.enableTelemetry": false, \ "telemetry.enableCrashReporter": false \ }' > /home/coder/.config/code-server/settings.json # Install Python extension for code-server RUN mkdir -p /home/coder/.local/share/code-server/extensions && \ curl -L -o /home/coder/.local/share/code-server/extensions/ms-python.python-2022.2.1924087327.vsix https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ms-python/vsextensions/python/2022.2.1924087327/vspackage && \ code-server --install-extension /home/coder/.local/share/code-server/extensions/ms-python.python-2022.2.1924087327.vsix # Change ownership of the configuration and extension directories RUN chown -R coder:coder /home/coder/.config && \ chown -R coder:coder /home/coder/.local # Expose the default code-server port EXPOSE 8080 # Define a volume for the genz folder VOLUME /home/coder/genz # Switch to the coder user for running code-server USER coder WORKDIR genz # Start code-server CMD ["code-server", "--bind-addr", "0.0.0.0:8080", "--auth", "none"]