# ======================================== # Persistent VS Code Space with Python (Root) # ======================================== FROM codercom/code-server:latest # 1. Switch to root user immediately USER root # 2. Install Python, git, and other utilities # Added 'curl' and 'wget' as they are often needed for development RUN apt-get update && \ apt-get install -y python3 python3-pip python3-venv git curl wget build-essential && \ apt-get clean && rm -rf /var/lib/apt/lists/* # 3. Setup Workspace Environment # Since we are root, our home is now /root, not /home/coder WORKDIR /root # 4. Configure Hugging Face persistent storage paths # We point these to /root so they persist if /root is mounted ENV HF_HOME=/root/hf_home ENV TRANSFORMERS_CACHE=$HF_HOME/transformers ENV HF_DATASETS_CACHE=$HF_HOME/datasets # This tells Spaces (if using a custom script) where the target persistence is ENV HF_PERSISTENT_STORAGE=/root # Set Timezone ENV TZ=Asia/Kolkata # 5. Expose the port (Hugging Face Spaces defaults to 7860) EXPOSE 7860 # 6. Start Code-Server # We point user-data-dir and extensions-dir to /root/vscode to keep config tidy CMD ["code-server", "--bind-addr", "0.0.0.0:7860", "--auth", "password", "--disable-telemetry", "--user-data-dir", "/root/vscode/data", "--extensions-dir", "/root/vscode/extensions", "/root/project"]