With everything that is going on outside we are forced to adapt and change the way we used to work. Some of us already work from home full time, but many of us are in this situation where we have to completely rethink our workflow. With this post, I hope I can help with you.
As developers, the issue is that we often rely on multiple components to be able to fully work on our projects. I am talking about runtime, dependencies, an API and even maybe a database. Sometimes theses things are not even on your computer but on a server somewhere on your company’s network, which makes it hard to bring with you everywhere.
So, what is the solution? Containers! I am sure everyone has at least heard of this at this point. If not, please get out of your home! (Wait after quarantine though) Because of this, I won’t explain in details the basics of containerization, but it’s a very interesting topic and there is plenty of resources online to learn more about it. Docker is super useful for solving a lot of problems and it's a great fit for solving our issues today.
So, you want to be able to work from home or everywhere else, but all the stuff needed to run your application is a mess to install and is not available on your operating system. With Docker you can replicate all of that on your laptop using a couple of Docker images with Docker-compose to “orchestrate” all of this locally.
Your environment will reside in a Docker-compose file that stays within your git repository and allows you to spin it up or down with ease everything that you need to work. You can declare your complete dev environment as code and stop worrying about having the right version, the right dependencies, and the right server every time. Adopting Docker in your development workflow will improve your time to market greatly and later, you can even use it in production with something like Kubernetes to modernize your infrastructure as well.
I know that this can be intimidating at first, especially if you never played with Docker. But the industry is already massively going into that direction and I have seen plenty of people do it and now they stopped troubleshooting their laptops and can finally focus on their code.
If you are looking for an exemple, I invite you to take a look at our project on Github to see how we've done it. You will see that we have more than one service running and they are all integrated in containers.
(Open the docker-comopose.yml file)