Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Use the latest stable Ubuntu LTS image
- FROM ubuntu:22.04
- # Set frontend to noninteractive to avoid prompts during package installation
- ENV DEBIAN_FRONTEND=noninteractive
- # Install dependencies: curl for downloading, wget (alternative), sudo for user privileges
- RUN apt-get update && \
- apt-get install -y --no-install-recommends \
- curl \
- wget \
- sudo \
- ca-certificates \
- # Clean up apt cache to reduce image size
- && rm -rf /var/lib/apt/lists/*
- # Install the latest stable release of code-server using the official script
- # The script handles dependencies needed by code-server itself
- RUN curl -fsSL https://code-server.dev/install.sh | sh
- # Install the Roo Code extension
- # Note: This runs as root initially, but code-server installs extensions per-user later if needed.
- # Running it here ensures it's available system-wide or for the default user setup.
- RUN code-server --install-extension RooVeterinaryInc.roo-cline
- # Create a non-root user 'coder' with a home directory and bash shell
- RUN useradd -m -s /bin/bash coder && \
- # Add the user to the sudo group
- adduser coder sudo && \
- # Allow the user to run sudo commands without a password
- echo 'coder ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
- # Switch to the non-root user
- USER coder
- # Set the working directory to the user's home directory
- WORKDIR /home/coder
- # Expose the default code-server port
- EXPOSE 8080
- # Default command to start code-server
- # Binds to 0.0.0.0 to be accessible outside the container
- # --auth none disables authentication (convenient for local dev, insecure for production)
- # For production, remove --auth none and set a password via environment variable or config file.
- CMD ["code-server", "--bind-addr", "0.0.0.0:8080", "--auth", "none"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement