foundry-rs / foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
https://getfoundry.sh
Apache License 2.0
8.18k stars 1.7k forks source link

Add devcontainer-feature.json to root #7290

Open mmsaki opened 7 months ago

mmsaki commented 7 months ago

Describe the feature you would like

Devcontainer feature allows you to set up foundry packages when you create your codespaces for any foundry project that has a .devcontainer.json

In your user's git project directory .devcontainer/devcontainer.json

{
"image": "mcr.microsoft.com/devcontainers/rust:1-1-bullseye",
  "features": {
    "ghcr.io/foundry-rs/foundry:latest": {}
  }
}

Reasons why using "onpostCreateCommand" | "postAttachCommand" | "postStartCommand" is not a good pattern for container package installations

  1. Each command you provide to "onpostCreateCommand" will be run in parallel, so you need to split into three commands, see this setup
  2. In our case, if you choose to run curl -L https://foundry.paradigm.xyz | bash && foundryup,foundryup will often fail since codespaces will alway run these commands in parallel, and not sequentially as you would expect

Adding devcontainer-feature.json

Only 3 fields are required, id, version, and name. Here's an example:

In this root directory ./devcontainer-feature.json

{
"id": "ghcr.io/foundry-rs/foundry",
"version": "1.1.0", // Each bump updated with dependabot integration see: https://containers.dev/guide/dependabot
"name": "Foundry Codespaces Feature (FCF)"
}

More information about the complete list of configurations possible for devcontainer-feature.json can be found here

Additional context

No response

zerosnacks commented 2 months ago

Hi @mmsaki thanks for your suggestion,

So I understand correctly, does this rely on Foundry having versioned releases? See: https://github.com/foundry-rs/foundry/issues/3895

mmsaki commented 2 months ago

@zerosnacks yes foundry would need versioned releases