Skip to content

PR: Add Bun Feature#142

Merged
koralowiec merged 2 commits into
devcontainers-extra:mainfrom
trevordcampbell:add-bun
Sep 6, 2025
Merged

PR: Add Bun Feature#142
koralowiec merged 2 commits into
devcontainers-extra:mainfrom
trevordcampbell:add-bun

Conversation

@trevordcampbell
Copy link
Copy Markdown
Contributor

@trevordcampbell trevordcampbell commented Sep 1, 2025

Summary

  • Adds Bun runtime feature:
    • bun: Installs Bun via GitHub Releases using the repo’s gh-release helper.
  • Provide a consistent bunx shim.
  • Add tests across Ubuntu/Debian/Alpine and pinned version scenarios.
  • Follow CONTRIBUTING and the project’s helper-first practices.

Motivation

  • Add first-class Bun support using the repository’s preferred patterns, ensuring reproducible installs, small layers, and broad distro/arch support.
  • Offer a helper-driven (gh-release) installation path to suit different needs.
  • Keep behavior consistent with other features in this repo and its guidelines (see CONTRIBUTING.md).

Features Added

  • src/bun
    • Install method: gh-release helper
    • Repo: oven-sh/bun
    • Asset selection: architecture and libc-aware, constrained to baseline builds:
      • Regex: bun-linux-(x64|aarch64)(-musl)?-baseline\.zip
      • Tag filter: tags starting with bun-v
    • Binary: bun/usr/local/bin
    • Adds bunx shim → /usr/local/bin/bunx executes bun x "$@"
    • Options:
      • version: string (default latest)
    • installsAfter:
      • ghcr.io/devcontainers-extra/features/gh-release

Usage Examples

  • Latest:
"features": {
  "ghcr.io/devcontainers-extra/features/bun:1": {}
}
  • Pinned:
"features": {
  "ghcr.io/devcontainers-extra/features/bun:1": {
    "version": "1.2.21"
  }
}

Tests

  • Scenarios:
    • Ubuntu latest: install Bun and validate bun --version
    • Debian latest: install Bun and validate bun --version
    • Alpine latest: install Bun and validate bun --version
    • Pinned Debian: install specific Bun version and assert bun --version
  • Notes:
    • Alpine validated through libc detection; test ensures musl asset is selected where needed.

Docs

  • README for Bun feature.
  • NOTES.md for Bun feature:
    • Links (Bun website, GitHub repo)
    • Pinning example
    • Distro/arch support
    • bunx shim rationale

Compatibility

  • Coexists with Node features; only places bun/bunx binaries.
  • System-wide binary ensures availability for non-root users without profile edits.

Security/Robustness

  • gh-release helper keeps installs reproducible and small.
  • No unnecessary PATH/profile mutations.

Checklist

  • Code matches project style; helpers used where applicable
  • Metadata (devcontainer-feature.json) includes options
  • Tests cover default and pinned versions across Ubuntu/Debian/Alpine
  • README + NOTES.md present for Bun Feature
  • Lints are clean

References

@trevordcampbell trevordcampbell changed the title # PR: Add Bun Features ('bun-gh-releases', 'bun-curl', 'bun-package' helper) PR: Add Bun Features ('bun-gh-releases', 'bun-curl', 'bun-package' helper) Sep 1, 2025
@koralowiec koralowiec self-requested a review September 2, 2025 17:50
@koralowiec
Copy link
Copy Markdown
Member

Hi Trevor, thanks for your contribution!

To be honest, I think that one way of installing a package/program/application should be sufficient - Having more than a single way makes it more costly to manage.

Do you know if there's any reason for installing bun with the curl over the GitHub releases? If there isn't any, then I would prefer to only introduce bun-gh-releases

As bun-package is kinda depending on bun-gh-releases/bun-curl, please inlcude it in a different PR. We will first deal with bun feature, then once it's released, we will run the tests for bun-package to verify it's okay, and review it.

@trevordcampbell
Copy link
Copy Markdown
Contributor Author

No reason for curl vs GitHub Releases installation – just figured I would give options for a reviewer to prune the one they wanted to keep (which you've just done!)

I've amended the PR commit to keep a main bun feature installed via gh-releases helper. And removed the bun-curl feature, as well was the bun-package helper feature (will submit that as a new PR once this main Bun feature is added).

@trevordcampbell trevordcampbell changed the title PR: Add Bun Features ('bun-gh-releases', 'bun-curl', 'bun-package' helper) PR: Add Bun Feature Sep 2, 2025
Copy link
Copy Markdown
Member

@koralowiec koralowiec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left few change requests

Comment thread src/bun/devcontainer-feature.json Outdated
Comment thread test/bun/scenarios.json Outdated
Comment thread test/bun/test.sh Outdated
Comment thread test/bun/test_alpine.sh Outdated
Comment thread test/bun/test_debian.sh Outdated
Comment thread test/bun/test_specific_version.sh Outdated
Comment thread test/bun/test_ubuntu.sh Outdated
Copy link
Copy Markdown
Member

@koralowiec koralowiec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now! Thanks Trevor for the contribution!

I'm going to merge the PR and start the release workflow. Once it's done, the feature should be available, and you can submit the bun-package PR

@koralowiec koralowiec merged commit 16fa715 into devcontainers-extra:main Sep 6, 2025
5 checks passed
@trevordcampbell trevordcampbell deleted the add-bun branch September 8, 2025 15:04
@koralowiec
Copy link
Copy Markdown
Member

FYI: The feature is released: https://github.com/devcontainers-extra/features/pkgs/container/features%2Fbun

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants