👩💻 I started loving GitHub Codespaces more and more 👩💻
I was
talking before about reviewing pull requests in codespace, but now I wanna tell you about another feature: container configuration.
I think we all know that all those codespaces are just containers + vs code in the browser. I was curious. Can I make a custom container with preinstalled Rust and other libraries? Because I always manually installed Rust before.
Of course, the answer is yes. First, I looked at container templates but couldn't find a suitable one. On the other hand, even if I found it, it wouldn't be flexible enough. Then I found out about dev containers. The devcontainer.json is a very flexible and convenient way to configure your codespace container. Here is a small guide:
🟢 Open the dev container configuration page (screenshot 1) by clicking the "
Configure dev container" button.
🟢 Add features. You can search in the marketplace for a needed one. (screenshot 2)
🟢 Commit changes.
🟢 Start a codespace. For example, by clicking the "
Create codespace on main" button.
🟢 It'll automatically install all needed libraries. (screenshot 3)
🟢 Now you can start coding 🥳.
As a result, I got the full-features web IDE: rust-analyzer, Rust itself, WASM target, my favorite theme, and icons. (screenshot 4) 💙
🔩 Official dev container documentation:
Introduction to dev containers.
containers.dev.
#github