mpvscode / Dockerfile
etsadiz's picture
Update Dockerfile
d3fa4e7 verified
# ================================================
# Minimal VSCode (code-server) Setup for MERN Stack Development
# ================================================
FROM ubuntu:22.04
# Non-interactive apt
ENV DEBIAN_FRONTEND=noninteractive
# Create a non-root user
RUN apt-get update && apt-get install -y sudo \
&& useradd -m -s /bin/bash coder \
&& echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
USER root
WORKDIR /home/coder
# -------------------------------
# Basic Development Tools
# -------------------------------
RUN apt-get update && apt-get install -y \
curl wget git unzip zip build-essential gnupg ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# -------------------------------
# Install Node.js (v22 LTS) + npm + yarn + pnpm
# -------------------------------
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g yarn pnpm
# -------------------------------
# Install code-server (VS Code in browser)
# -------------------------------
RUN curl -fsSL https://code-server.dev/install.sh | sh
# -------------------------------
# Setup workspace directories
# -------------------------------
RUN mkdir -p /home/coder/workspace /home/coder/.config/code-server /home/coder/.local/share/code-server \
&& chown -R coder:coder /home/coder
# -------------------------------
# Configure code-server authentication
# -------------------------------
USER coder
WORKDIR /home/coder/workspace
# Default password (can be overridden by Hugging Face secret or -e PASSWORD)
ENV PASSWORD=mernpassword
# Write the config file so code-server knows to use password auth
RUN echo "bind-addr: 0.0.0.0:7860\nauth: password\npassword: ${PASSWORD}\ncert: false" > /home/coder/.config/code-server/config.yaml
# -------------------------------
# Expose port and start code-server
# -------------------------------
EXPOSE 7860
CMD ["bash", "-c", "PASSWORD=${PASSWORD} code-server --config /home/coder/.config/code-server/config.yaml --user-data-dir /home/coder/.local/share/code-server"]