Spaces:
Sleeping
Sleeping
Piyusharanjan Pradhan
commited on
Commit
·
ef80460
1
Parent(s):
7b6b075
vs code init
Browse files- Dockerfile +54 -0
- README.md +41 -5
Dockerfile
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use Ubuntu as base image
|
| 2 |
+
FROM ubuntu:22.04
|
| 3 |
+
|
| 4 |
+
# Set environment variables
|
| 5 |
+
ENV DEBIAN_FRONTEND=noninteractive \
|
| 6 |
+
CODE_SERVER_VERSION=4.96.2 \
|
| 7 |
+
PASSWORD=huggingface
|
| 8 |
+
|
| 9 |
+
# Install dependencies
|
| 10 |
+
RUN apt-get update && apt-get install -y \
|
| 11 |
+
curl \
|
| 12 |
+
wget \
|
| 13 |
+
git \
|
| 14 |
+
sudo \
|
| 15 |
+
vim \
|
| 16 |
+
nano \
|
| 17 |
+
build-essential \
|
| 18 |
+
python3 \
|
| 19 |
+
python3-pip \
|
| 20 |
+
nodejs \
|
| 21 |
+
npm \
|
| 22 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 23 |
+
|
| 24 |
+
# Install code-server
|
| 25 |
+
RUN curl -fsSL https://code-server.dev/install.sh | sh
|
| 26 |
+
|
| 27 |
+
# Create a non-root user
|
| 28 |
+
RUN useradd -m -s /bin/bash coder && \
|
| 29 |
+
echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
| 30 |
+
|
| 31 |
+
# Set working directory
|
| 32 |
+
WORKDIR /home/coder
|
| 33 |
+
|
| 34 |
+
# Create workspace directory
|
| 35 |
+
RUN mkdir -p /home/coder/workspace && \
|
| 36 |
+
chown -R coder:coder /home/coder
|
| 37 |
+
|
| 38 |
+
# Switch to non-root user
|
| 39 |
+
USER coder
|
| 40 |
+
|
| 41 |
+
# Expose port 7860 (Hugging Face Spaces default port)
|
| 42 |
+
EXPOSE 7860
|
| 43 |
+
|
| 44 |
+
# Create config directory
|
| 45 |
+
RUN mkdir -p /home/coder/.config/code-server
|
| 46 |
+
|
| 47 |
+
# Set up code-server config
|
| 48 |
+
RUN echo "bind-addr: 0.0.0.0:7860" > /home/coder/.config/code-server/config.yaml && \
|
| 49 |
+
echo "auth: password" >> /home/coder/.config/code-server/config.yaml && \
|
| 50 |
+
echo "password: ${PASSWORD}" >> /home/coder/.config/code-server/config.yaml && \
|
| 51 |
+
echo "cert: false" >> /home/coder/.config/code-server/config.yaml
|
| 52 |
+
|
| 53 |
+
# Start code-server
|
| 54 |
+
CMD ["code-server", "--bind-addr", "0.0.0.0:7860", "--auth", "password", "/home/coder/workspace"]
|
README.md
CHANGED
|
@@ -1,10 +1,46 @@
|
|
| 1 |
---
|
| 2 |
-
title: Code
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: VS Code on Web
|
| 3 |
+
emoji: 💻
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: purple
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
| 8 |
+
app_port: 7860
|
| 9 |
---
|
| 10 |
|
| 11 |
+
# VS Code on Web - Hugging Face Spaces
|
| 12 |
+
|
| 13 |
+
This Space deploys VS Code in your browser using code-server.
|
| 14 |
+
|
| 15 |
+
## Features
|
| 16 |
+
|
| 17 |
+
- 🌐 VS Code running in your browser
|
| 18 |
+
- 🐍 Pre-installed Python 3 and pip
|
| 19 |
+
- 📦 Node.js and npm included
|
| 20 |
+
- 🛠️ Build tools and common utilities
|
| 21 |
+
- 🔒 Password-protected access
|
| 22 |
+
|
| 23 |
+
## Access
|
| 24 |
+
|
| 25 |
+
Once deployed, access your VS Code instance through this Space. The default password is `huggingface`.
|
| 26 |
+
|
| 27 |
+
## Configuration
|
| 28 |
+
|
| 29 |
+
- **Port**: 7860
|
| 30 |
+
- **Default Password**: `huggingface`
|
| 31 |
+
- **Workspace Directory**: `/home/coder/workspace`
|
| 32 |
+
|
| 33 |
+
## Installed Tools
|
| 34 |
+
|
| 35 |
+
- Git
|
| 36 |
+
- Python 3 with pip
|
| 37 |
+
- Node.js with npm
|
| 38 |
+
- Build essentials (gcc, g++, make)
|
| 39 |
+
- Text editors (vim, nano)
|
| 40 |
+
- curl, wget
|
| 41 |
+
|
| 42 |
+
## Notes
|
| 43 |
+
|
| 44 |
+
- You can install additional VS Code extensions through the browser interface
|
| 45 |
+
- Files created in the workspace persist during the session
|
| 46 |
+
- For persistent storage, consider using Hugging Face Datasets or external storage
|