Vscode / README.md
Hemifield's picture
Upload 3 files
373bb4f verified
|
Raw
History Blame Contribute Delete
1.89 kB
---
title: VS Code + Claude Code + Codex
emoji: πŸ’»
colorFrom: blue
colorTo: purple
sdk: docker
app_port: 7860
---
# VS Code (code-server) with Claude Code & OpenAI Codex
Browser-based VS Code, with the `claude` and `codex` CLIs preinstalled, and persistent
storage via a Hugging Face [Storage Bucket](https://huggingface.co/docs/hub/storage-buckets)
mounted at `/data`.
## 1. Set a password secret
In **Space settings β†’ Variables and secrets**, add a secret:
- `PASSWORD` = a password of your choice
(If you skip this, code-server generates a random password each restart and prints it
to the Space's container logs β€” check there if you didn't set one.)
## 2. Create and attach a storage bucket (free persistent storage)
```bash
# create the bucket (one-time)
hf buckets create my-vscode-data
# attach it to this Space, mounted at /data
hf spaces volumes set <your-username>/<this-space> -v hf://buckets/<your-username>/my-vscode-data:/data
```
You can also do this from the Space's **Settings β†’ Storage Buckets** UI, mount path `/data`.
Note that `/data` is only available at *runtime*, not during the Docker build β€” the
`entrypoint.sh` script detects it on container start and, if present, points `$HOME` at
`/data/home` (seeding it from the image's default home on first run). Everything under
your home directory persists: your workspace, VS Code settings/extensions, `claude`/`codex`
logins, shell config, the works. Without an attached bucket, everything still works, just
ephemerally (lost on restart).
## 3. Log in to Claude Code and Codex
Open a terminal inside VS Code (``Ctrl+` ``) and run:
```bash
claude # follow the login prompt (or set ANTHROPIC_API_KEY as a Space secret)
codex # follow the login prompt (or set OPENAI_API_KEY as a Space secret)
```
With a bucket attached, you only need to log in once β€” credentials persist across restarts.