Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install bun when required in Devcontainer #51604

Conversation

duduribeiro
Copy link
Contributor

Motivation / Background

Currently when you generate a Rails app with bun the devcontainer image does not contains the bun itself, so you need to manually install it. This commit installs bun when required.

Detail

I implemented this by adding bun installation directly to the .devcontainer/Dockerfile file, which made the Dockerfile not so clean like previously.

The best way would be to install bun via a devcontainer feature, which would allow us to install bun in the devcontainer.json instead, like we do for activestorage, datbase clientes and github cli.

But there is no official bun feature that is maintained by the official Dev Container Spec Maintainers from the official features repo. The available bun features are from the community:

bun Shyim ghcr.io/shyim/devcontainers-features/bun:0 0.0.1
bun Michael Lohr ghcr.io/michidk/devcontainers-features/bun:1 1.0.1
Bun audacioustux ghcr.io/audacioustux/devcontainers/bun:1 1.0.0
Bun Pablo Ulloa ghcr.io/prulloac/devcontainer-features/bun:1 1.1.2
bun lumenpink ghcr.io/lumenpink/devcontainer-features/bun:0 0.0.1

and I don't know if it is feasible for Rails to use these bun feature instead an "official" one.

I tried to create a feature inside rails/devcontainer-features but it got rejected with the suggestion to try to create it directly inside the official repo, which was declined as well with the reason: the devcontainers/features repo only accepts improvements and bug fixes for the [current set of maintained Features](https://github.com/devcontainers/features/blob/main/src)., so no bun official feature will be available.

There is one solution if we want to stick with the features installation method instead of the Dockerfile one:

we can create a folder .devcontainer/features/bun and reference this folder inside the devcontainer.json:

	"features": {
		"./features/bun": {}
	},

but I want to check your preferences before implementing this.

thoughts?

Thanks! 馃嵒

Additional information

How to test

  • generate an app with bun bundle exec rails new ../testbundevcontainer -j bun --dev
  • the .devcontainer/Dockerfile should include bun installation cat .devcontainer/Dockerfile | grep bun

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Unrelated changes should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Tests are added or updated if you fix a bug or add a feature.
  • N/A CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.

Currently when you generate a Rails app with bun the devcontainer
image does not contains the bun itself, so you need to manually
install it. This commit installs bun when required.
@rails-bot rails-bot bot added the railties label Apr 18, 2024
@rafaelfranca
Copy link
Member

rafaelfranca commented Apr 18, 2024

Thank you for the pull request. Yeah, we don't want to define it inside the Dockerfile.

Maybe as a last try we should suggest to the Bun project itself as an official feature they will maintain? It doesn't make sense to Rails to maintain a feature for bun, since well, long term, we don't want any node or other JavaScript runtimes requirements for Rails applications.

Failing bun supporting the feature. We will just accept that Rails will not generate a working devcontainer if you select bun as the JavaScript runtime.

Closing the PR since this isn't the path we want to take.

@duduribeiro duduribeiro deleted the install-bun-when-required-in-devcontainers branch April 18, 2024 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants