Docker development environment for Elixir+Phoenix
Switch branches/tags
Nothing to show
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Dockerfile Update Dockerfile Feb 2, 2018
LICENSE Initial commit Feb 2, 2018
README.md Update README.md Feb 7, 2018
docker-compose.yml Comments clean up Feb 2, 2018
run.sh feature: Run tests to verify correct setup Feb 7, 2018

README.md

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 DOCKERFILE is 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.

Instructions

  1. Copy the three config files to an existing Phoenix project which you want to Dockerize. Make run.sh executable, e.g. chmod +x run.sh.
  2. Edit your development database settings to connect to Postgres at host db, username postgres, password empty string.
  3. Spin it up with docker-compose up.

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.