One of the biggest complaints the developers had during the round of interviews is that it is very hard to run the application locally and to get started. Because there are so many changes for the various customers, the code base changes frequently. To quickly get started with a stable version for a customer, to test some things or to add minor features takes too much time. Furthermore, once the application is deployed, unknown issues occur because production is so different from the development environment.
Fabrikam wants to move towards the Azure Cloud in the proposed solution architecture. Because of the already existing on-premises application, they want to move to the cloud with as few changes as possible to the on-premises application. You and your team advice to start using Docker.
Docker allows them to package the existing application, including all (older) frameworks in a container and run this as a web application. Using containers also allows Fabrikam to run a cloud-native architecture without a lock-in to a specific cloud because containers are cloud-agnostic. Therefore the team decides to start using Docker containers for their local development too. Since they already ran the MongoDB in a container, now it is time to move the rest to the cloud as well.
In this challenge you will create a container for the API and WEB application. For that you need to create a Dockerfile in the content-api and the content-web folder that builds and runs the API and WEB application. One of the developers is very eager about this and already started work in the evening and shared this gist for the api and this gist for the web app with you that builds and runs the application. Make sure you embed this in the source code and run the API and WEB app in the container.
You also decide it is convenient to have a container for the Initialization of the database contents. There is a gist created for that as well.
- Dockerfile that builds and runs the API is part of the content-api folder. Call the Docker image [fabrikam-api]
- Dockerfile that builds and runs the WEB app is part of the content-web folder. Call the Docker image [fabrikam-web]
- Dockerfile that builds and runs the INIT app is part of the content-init folder. Call the Docker image [fabrikam-init]
- API accesses the MongoDB in the container
##Tip
Use the
docker buildcommand to build a container in your CodespaceUse the
docker imagescommand to check if the images are builtUse the
docker runcommand to run a container in your Codespace. Use the--nameand--networkswitches to name them. Name the web application containerweband the api containerapi. Use the-pswitch to port forward the port 80 and 3001 to your local systemMake sure the 3 containers run on the same network
You can access another container on the same network by name. For example: If you call your running container
apiyou can access this by navigating tohttp://apiin another container
If you are stuck or you want to progress to the next challenge, there is a solution prepared for you. When you run the following command from the PowerShell Terminal from a PowerShell terminal, a Pull Request with the files and instructions will be created for you.
Workshop-Step Solution "DEVWF-T003"To read or view a step by step explanation of this challenge, please visit this page
When you are done, move to the next challenge