Add 'Bun Development Environement' devcontainer #7083
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Added VSCode DevContainer to automate setup of Bun development environment.
TLDR;
bun-devcontainerimage Dockerfile + dependency build setup scriptsFirst off, I'm a huge fan of the project! I initially wanted to help contribute by looking into fixing the devcontainer lockfile issue - #4923
I started out seeing I could build the bun repo in a devcontainer cause I didn't want to contaminate my existing macbook development environment. I use isolated devcontainers where I can.
It's my view that the value of being able to contribute to the bun project itself or developing with bun javascript projects in isolation with other dev environments on a dev's work or personal machine and not have to worry about setup of extensive deps that can interfere with other projects is a must.
Also devcontainers are great at allowing a project to capture infra as code for the development environment in source control and each contributor could rely on working with the same environment every time an issue is reported or giving confidence PRs are at least testing with a consistent dev env. Hopefully I don't have to sell it much more :)
How did you verify your code works?
Tested building docker image
Built and tested using Macbook M1
From bun repo folder
cd ~/code/bunBuild the image - Ideally this image would be built via CI or something and published most likely the same way the oven/bun image is. This probably goes with out saying, but contributor developers wouldn't need to build the
bun-devcontainerimage.cd .devcontainer && ./build-devcontainer.shTested opening devcontainer + bun project in VSCode
code .Open project in the devcontainer
Command-Shift-P->dev Containers: Reopen in ContainerYou should see this message after devcontainer is ready for work.

Now build bun as normal. I found I had to run
scripts/clean-dependenciesto clean out all the other failed attempts to get the build environment right first.bun setupAnd Bob's your uncle!

Testing running bun-debug binary and debugging in VSCode with LLVM extension
TODO: Building the multiple images for each supported target architectures. I might need help with this I'm not familiar with this project and build pipeline.
Looking forward to any feedback or if this is something the project wants to incorporate. This change is definitely not a triumph or anything but a nice to have even if it only lives on in my fork. Thanks.