File size: 1,661 Bytes
f89fbfc cffa4b0 40feda4 f89fbfc 916c7c6 f89fbfc 5fbbb26 f89fbfc 916c7c6 e470f49 679f542 916c7c6 f89fbfc cffa4b0 5fbbb26 cffa4b0 5fbbb26 679f542 5fbbb26 679f542 5fbbb26 f89fbfc cffa4b0 f89fbfc cffa4b0 f89fbfc 5fbbb26 f89fbfc 5fbbb26 f89fbfc | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | FROM ubuntu:22.04
# Prevent interactive prompts during apt installations
ENV DEBIAN_FRONTEND=noninteractive
# 1. Install base utilities and sudo as root
RUN apt-get update && apt-get install zstd && apt-get install -y \
curl wget git jq unzip build-essential \
python3 python3-pip sudo \
&& rm -rf /var/lib/apt/lists/*
# 2. Install VS Code Server (code-server) as root
RUN curl -fsSL https://code-server.dev/install.sh | sh
# 3. INSTALL NODE.JS (v24.x) via NodeSource
RUN curl -fsSL https://deb.nodesource.com/setup_24.x | bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
# 4. Create the user, set bash as default, add to sudo group
RUN useradd -m -s /bin/bash -u 1000 -G sudo user \
&& echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/user \
&& chmod 0440 /etc/sudoers.d/user
# 5. Set up environment variables (ADDED NPM_CONFIG_PREFIX AND UPDATED PATH)
ENV HOME=/home/user
ENV NPM_CONFIG_PREFIX=/home/user/.npm-global
ENV PATH="/home/user/.npm-global/bin:/home/user/.local/bin:/home/user/.cargo/bin:/home/user/.bun/bin:$PATH"
# 6. Transfer ownership of the home directory from root to user
RUN chown -R user:user /home/user
# 7. Switch to the non-root user
USER user
WORKDIR $HOME
# 8. Set up npm global directory for the user so 'sudo' is never needed for npm
RUN mkdir -p /home/user/.npm-global
# 9. Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# 10. Install Bun
RUN curl -fsSL https://bun.sh/install | bash
# Expose port
EXPOSE 7860
# Start VS Code Server
CMD ["code-server", "--bind-addr", "0.0.0.0:7860", "--auth", "none", "--disable-telemetry"] |