Elixir TIL: Start Plug-based Apps without Stopping

Jun 9, 2022

If you are writing a Dockerfile for your Elixir app, the final CMD line may look like:

CMD ["mix", "phx.server"]

But for Elixir apps that use Plug only without Phoenix, we don't have mix phx.server.

The solution comes from mix doc:

mix run --no-halt

This is the production script. For starting the app locally, you can just do iex -S mix which attaches a repl session to the running server as well.