-
Notifications
You must be signed in to change notification settings - Fork 0
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Dev Container #8
Conversation
mix local.hex --force | ||
mix deps.get |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like these are the two most relevant commands to run immediately after creating the container.
Without, an initial run of mix test
prompted me to run mix local.hex --force
and an initial run of mix docs
required running mix deps.get
.
For a library like this, are there other helpful commands that should be run after container creation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick note here in case it's instructive: Elixir's build tool mix
has a concept of environments. Briefly, each environment is a completely separate build of the project but with slight configuration changes.
:compare_chain
itself has no dependencies in the :prod
or :test
environments. But it does have the :ex_doc
dependency in the :dev
environment. We can see these two facts from how :compare_chain
declares its dependencies in mix.exs
:
defp deps do
[
{:ex_doc, "~> 0.31", only: :dev, runtime: false}
# ^^^^^^^^^^
]
end
This is why you can run mix test
(which runs in the :test
environment) without needing mix deps.get
, but you do need it to run mix docs
(which runs in the :dev
environment).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For a library like this, are there other helpful commands that should be run after container creation?
No I think what's there is good!
"EditorConfig.EditorConfig", | ||
"JakeBecker.elixir-ls" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there other popular Elixir extensions for VS Code that would be candidates for inclusion here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I think these are sufficient.
@jgarber623 I'm getting that thing where the terminal is stuck after building the container and I forget how to get past it. Do you remember? ![]() |
@billylanchantin You can either click the trash can icon to close that Terminal tab or click the plus icon to create a new Terminal tab. |
The trash icon worked, thanks! I really need to learn more about VSCode's terminal. It just wasn't obvious to me that what I was looking at was something I could close. |
That specific Terminal (the one aggregating Dev Container creation output) is particularly annoying for this reason. Unlike the Dev Container lifecycle scripts (e.g. |
This commit adds a basic Elixir Dev Container along with some useful tooling like the latest version of Git, the GitHub CLI, and the Elixir language server extension.
d527ee8
to
9f59cff
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good!

One concern I have is about publishing to hex. This isn't something we need to worry about on our private repos, but I want to make sure what gets published is as lean as possible. That is, I'd like to make it so our devcontainer code never gets published if we can avoid it.
This is sorta nit-picky since it would be essentially dead code at that point. But I'd still like to read about how mix hex.publish
works to see what level of control is possible before we merge.
@billylanchantin Yes! That's a great callout. Taking a quick look at the documentation:
That's… ambiguous… unless you happen to know what "standard project directories" are but I would guess that |
@billylanchantin Package and docs publishing can be tested locally:
The former yields:
|
@jgarber623 Ah excellent! Yeah doesn't look like the devcontainer stuff is bundled, which makes sense. I also found these docs to be a bit more detailed:
I don't know why there are multiple versions of this documentation... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! I think this is good to go.
I'm still curious about the intersection of mix
environments and devcontainers. I think best practices are still emerging so I don't think we need to solve everything here.
This PR adds a Dev Container to the project for easier project setup and development.
There are a number of IDEs and tools that support Dev Containers, but the following testing instructions will assume VS Code (for good or for ill).
git switch add-devcontainer
cmd-shift-p
on macOS) and serach for "Dev Containers: Reopen in Container"cmd-j
on macOS to show the panel)mix format --check-formatted
mix test
mix docs
🥳