Elixir / Phoenix containerized development environment
What you get
- One-line dev environment setup:
docker-compose up. It creates the database, does the Dialyzer pre-work (if the project has Dialyxer installed), and everything else.
- Development-oriented config: Source code is mounted so that changes in the container appear on the host, and vice-versa.
- Fast re-builds because the
DOCKERFILEis written to help Docker cache the images.
- Syncing with Postgres startup delay.
- All the crappy little dependencies installed.
- No weird hacks.
Uses Elixir 1.6.1, Phoenix 1.3.0, and latest Postgres. These are the latest versions as of 2018-02-02. Tested on MacOS and Fedora Linux, because that's what I happen to use. This is my configuration I develop with.
- Copy the three config files to an existing Phoenix project which you want to Dockerize. Make
chmod +x run.sh.
- Edit your development database settings to connect to Postgres at host
postgres, password empty string.
- Spin it up with
Tests can be run in the container like so:
docker-compose run web mix test
Or, for a slightly faster startup time,
docker-compose exec web mix test
... I haven't found a disadvantage of re-using the running container this way.