The plan is to have the Elixir and Phoenix work entirely within the container, even allowing projects to be started from scratch; thereby removing the need to have Elixir and Phoenix installed on the host machine.
The intention here is that these steps will get a relative newcomer up and running: with some understanding. It is written to be relatively gentle on the reader, if a bit slow for some.
Using Docker so that the project:
- can be reproduced on demand for colleagues or others.
- is largely prepared for deployment through Docker.
- can co-exist with other projects using different version permutations.
Choosing/ constructing Docker images so that they are lean and targetted to the purpose in hand.
To enable IDEs and other tools (on the host machine) to work with source code inside a container.
Using 'docker-compose' so that parameters are scripted in the YAML format for clarity and simplicity.
This exercise was constructed and tested on the following platform:
There are a couple of ways of installing docker on Ubuntu; the recommended one is documented on the Docker website
Reproducing this exercise should work just fine on Linux and Mac platforms. Windows however, would be tricky for reasons explained in step 2.
It is good to have a graphical view into what is going on within the docker server. Installing Portainer Community Edition as a container is a good option, allowing interaction through a browser.
Given that a database is involved it is also good to have a GUI based SQL tool on hand. BeeKeeper Studio is one option (also available among the snap applications on Ubuntu).
This overall exercise reflects lessons learned the hard way by the author - a journey that took time. This route works; however there may be better techniques - it is humbly requested that such wisdom is shared constructively in the comments.
You are expected to use this as a kind of template. Use your own project acronym, use later editions of PostgreSQL, PostGIS, Elixir and/ or Phoenix; as you need.
If you don't need PostGIS: you can either leave it in or figure out which parts to adjust as you go through.