Setting Up the Local Environment
Learn how to create efficient and consistent developer environments using Docker.
We'll cover the following
The developer environment is a critical aspect of enabling nimble iterations, shortening the feedback loop, and encapsulating security best practices during the development life cycle. Traditionally, a developer might have set up all of the dependencies, preferred libraries, and command-line utilities, as well as the IDE, on a physical workstation. While that can be done, advances in technology (e.g., leveraging containerization principles) also enable modern developers to take advantage of reusable environments hosted in the cloud.
Let’s look at two scenarios aimed at a repeatable and reliable developer setup. We’ll first look at configuring a local workstation environment, then move on to examine the world of virtual developer environments through utilities such as GitHub Codespaces and Dev Containers for Visual Studio Code.
Creating local infrastructure using Docker
As we’ve seen in previous chapters, using Docker and Docker Compose can speed up our local development time by providing us with a local representation of the infrastructure we might see in the cloud. But what about different implementations, such as a Kubernetes cluster? Let’s first look at running the stack locally with Docker Compose, and then we’ll shift to utilizing Kubernetes as the target for infrastructure.
Standing up infrastructure using Docker Compose
One nice thing about the work we’ve done previously is that it’s completely reusable in our scenario now. To get started, copy over the docker-compose.yml
file from the Implementing Message Broker Technologies lesson to any of the domain solution folders in the src
directory (This has already been done for us in the coding playground at the end of the lesson). This will provide us with a baseline Kafka implementation that we can connect to when debugging service code.
For the purpose of this walkthrough, we’ll be using the MTAEDA.Equipment
solution to illustrate where to place the file, and Visual Studio to illustrate how to trigger the startup of the Docker services.
To start, our domain solution root folder should look like the figure below, where the docker-compose.yml
file has been copied in:
Get hands-on with 1400+ tech skills courses.