Docker file for Phoenix
How many time have you started some project, setup your machine with the correct version of softwares and then after a while have to move to another PC or something went wrong with your PC and you have to redo the things again and you forget what you did last time to setup. This has happened to me a lot. I try to make my development environment efficient and something that I can replicate later on as well or even move to a server. This is where Docker shines. It allows you to easily spawn up new container, isolated from rest of your environment, in which you can run and test your application and that same container can then later be deployed to production environment, albeit with few other changes. There is also a huge community who have already done what you want to do, so you can use their docker files to spawn a container instead of creating your own from scratch.
I am playing with Phoenix Framework for Elixir. It is a framework to create web service and web sites in general. In my current development setup I have the docker container running with a folder on my host machine mounted on the docker container. This allows me to make changes in the application and the docker container is able to see those changes directly. After starting the server in that container, as I develop, the Cowboy server picks up my changes without me restaring the server again, I can see the changes instantenously. This increases the speed with which one can iterate. As it's a docker container so I know that to run it on a server all I have to do is package it with the application source code and then just start.
I created my own docker file instead of using existing one as i like my environment setup in a certain way. To use the docker file I created run the following, make sure you have docker installed
git clone https://github.com/zabirauf/Dockerfiles.git cd Dockerfiles/Phoenix docker build -t phoenix .
It will take a while to create the image then you can use that image to run your phoenix app or even play around with phoenix framework
docker run -i -t -p 4000:4000 phoenix /bin/bash
This should start the docker container with that image and allow you to use shell.