File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ """
2+ A simple VSCode server that runs in a remote environment using Pod. Access the full
3+ VSCode experience directly from your browser, anywhere.
4+
5+ To deploy: python app.py
6+ """
7+
8+ from beam import Pod , Image
9+
10+ OPENVSCODE_SERVER_VERSION = "1.97.2"
11+ VSCODE_PORT = 8080
12+
13+ image = Image ("python3.12" ).add_commands (
14+ [
15+ f"wget https://github.com/gitpod-io/openvscode-server/releases/download/openvscode-server-v{ OPENVSCODE_SERVER_VERSION } /openvscode-server-v{ OPENVSCODE_SERVER_VERSION } -linux-x64.tar.gz" ,
16+ f"tar -xzf openvscode-server-v{ OPENVSCODE_SERVER_VERSION } -linux-x64.tar.gz" ,
17+ f"mv openvscode-server-v{ OPENVSCODE_SERVER_VERSION } -linux-x64 /opt/openvscode-server" ,
18+ f"rm openvscode-server-v{ OPENVSCODE_SERVER_VERSION } -linux-x64.tar.gz" ,
19+ "mkdir -p /root/.local/share/openvscode-server/extensions" ,
20+ "chmod +x /opt/openvscode-server/bin/openvscode-server" ,
21+ ]
22+ )
23+
24+ vscode_server = Pod (
25+ image = image ,
26+ ports = VSCODE_PORT ,
27+ cpu = 4 ,
28+ memory = "8Gi" ,
29+ entrypoint = [
30+ "/opt/openvscode-server/bin/openvscode-server" ,
31+ "--host" ,
32+ "::" ,
33+ "--port" ,
34+ str (VSCODE_PORT ),
35+ "--without-connection-token" ,
36+ "--disable-workspace-trust" ,
37+ "--telemetry-level" ,
38+ "off" ,
39+ "/root/app" ,
40+ ],
41+ )
42+
43+ res = vscode_server .create ()
44+ print ("Access your VSCode server at: " , res .url )
You can’t perform that action at this time.
0 commit comments