Stream: ideas

Topic: devcontainer


view this post on Zulip Timon Krebs (Dec 20 2024 at 23:16):

I find it really convenient to be able to spin up a codespace that is preconfigured with all the project dependencies. It lets me jump right into coding, no matter where I am no setup needed. Even on my phone or in a locked-down work environment where I can't install a full dev environment. Codespaces has a really generous free tier, so anyone with a GitHub account can use it. This is especially great for people who don't have access to powerful machines.

When devcontainer configured you can spin up a codespace from github by pressing . in the gh repo and start coding right in the browser or wehrever else you like.

https://github.com/features/codespaces

https://code.visualstudio.com/docs/devcontainers/containers

This is a first draft for roc

// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/rust
{
    "name": "Rust",
    // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
    "image": "mcr.microsoft.com/devcontainers/rust:1-1-bullseye",

    // Use 'mounts' to make the cargo cache persistent in a Docker Volume.
    // "mounts": [
    //  {
    //      "source": "devcontainer-cargo-cache-${devcontainerId}",
    //      "target": "/usr/local/cargo",
    //      "type": "volume"
    //  }
    // ]

    // Features to add to the dev container. More info: https://containers.dev/features.
    "features": {
        "ghcr.io/devcontainers-contrib/features/zig:1": {},
        "ghcr.io/devcontainers-community/features/llvm": {}
    }
    // Use 'forwardPorts' to make a list of ports inside the container available locally.
    // "forwardPorts": [],

    // Use 'postCreateCommand' to run commands after the container is created.
    // "postCreateCommand": "rustc --version",

    // Configure tool-specific properties.
    // "customizations": {},

    // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
    // "remoteUser": "root"
}

view this post on Zulip Anton (Dec 21 2024 at 15:23):

in the gh repo and start coding right in the browser or wehrever else you like.

Yeah that would probably reduce friction a lot for new contributors. I tried to set this up before but I think I hit some difficult errors with the dependencies. Did this json work for you already?

view this post on Zulip Timon Krebs (Dec 22 2024 at 00:13):

Yes it works for me with vs code devcontainer and wsl. I had to manually run sudo apt-get update && apt-get install -y pkg-config libz-dev libzstd-dev valgrind.

But we should be able to do this also on startup by adding "onCreateCommand": "sudo apt-get update && apt-get install -y pkg-config libz-dev libzstd-dev valgrind" to the devcontainer.json

view this post on Zulip Timon Krebs (Dec 22 2024 at 20:35):

@Anton I tested it also on Github Codespaces and also worked there with only this json: https://github.com/roc-lang/roc/pull/7404

view this post on Zulip Timon Krebs (Dec 22 2024 at 20:48):

It would be even cooler, and less overhead on startup, if we could build a dedicated devcontainer for roc and put it here: https://github.com/roc-lang/roc/tree/main/docker and in the officoal roc Docker Hub https://hub.docker.com/u/roclang.

view this post on Zulip Anton (Dec 23 2024 at 13:12):

Sounds good :)

view this post on Zulip Timon Krebs (Jan 03 2025 at 23:01):

What would be the best way to publish this roc-devcontainer? I sketched out this: https://github.com/timonkrebs/roc/commit/ffe6f77a272bb842096687e5a3ef7151e3404ee2 ... is this feasible or do you have better ideas?

view this post on Zulip Anton (Jan 04 2025 at 09:08):

You can put it in https://github.com/roc-lang/roc/tree/main/docker, then it will be published with https://github.com/Anton-4/roc-dockerhub/blob/main/.github/workflows/docker-publish.yml


Last updated: Jun 16 2026 at 16:19 UTC