Hello all, I’m writing this post to see if there is any interest for an idea I had.
Recently I’ve been using devcontainers in my team and I think they offer a lot of value. In particular when working in a team context (no more “I don’t have XYZ installed” problems).
I noted we have a .devcontainer in the rails repository itself, to me this indicates that the core team see value in using devcontainers as well.
I think it would be nice to have a --devcontainer flag in the rails new command. e.g.
rails new app --devcontainer
By default this command would be set to false but when included this command would setup a .devcontainer directory.
I have some ideas about what I’d like to be included in this directory, by default, but I don’t want to be overly prescriptive so would like to gather people’s thoughts on both:
Despite what I said above, one overly prescriptive idea I had would be to use Docker in Docker to spin up a mysql container alongside the devcontainer, given the recent enthusiasm for mysql.
I have started making an experimental fork on this which has the basic functionality of creating a template, but want to check if there’s any interest in this idea or if it’s a complete non-starter before taking it any further.
I would love to offer support and learn more about it.
I’ve already attempted twice to replicate the same work/development experience as with the ‘normal’ Docker Compose (something like Ruby on Whales: Dockerizing Ruby and Rails development—Martian Chronicles, Evil Martians’ team blog, but I use a sophisticated version). Typically, I use a template for my new Rails projects, enabling me to perform all the tasks locally that I would do with a standard Rails project. However, I’m encountering some issues in devcontainers.
Initially, using it directly in VS Code results in a new VS Code setup without any extensions installed. I haven’t investigated thoroughly yet, but it’s likely that you can install specific extensions locally without including them in the devcontainers setup for all developers.
Utilizing Installing and working with the devcontainer CLI comes with several limitations. One example is that you cannot even run something like devcontainer down. I might be missing something due to a lack of knowledge, but I haven’t found a solution for this yet. Also, you do not have easy overview and management of your volumes, as you have with normal docker compose.
So fare, I was ending up twice to not work with devcontainers, as my usual setup is much better experience.