How to Run Your Docker Containers in Choreo
By Nilesh Jayanandana
- 1 Nov, 2022
Choreo is an internal developer platform that enables building and running cloud native applications at scale. With the addition of custom Dockerfile support, you can leverage the benefits offered by the platform including cloud development, multi-environment deployment, testing, and observability.
Let’s explore how you can use these capabilities to develop and manage a REST API written in Go.
Choreo merely requests that you connect your repository and provide minimal instructions to build your application. As shown in Figure 1, you simply need to provide the path to your Dockerfile, the build context relative to the root of your repository, the port on which your service is running, and the openAPI Spec if it is available in the repository. Choreo takes it from there.
Figure 1: Bring your Dockerfile build configuration
Setting up CI/CD pipelines can be difficult, but as shown in Figure 2, Choreo automatically adds the relevant CI steps to your pipeline, such as image vulnerability scanning, code vulnerability scanning, and possible Dockerfile misconfigurations as soon as you create your component. All these steps ensure that your application is secure and has the necessary components to operate in a production environment.
Figure 2: CI pipeline of a non-Ballerina runtime application
Before making your application available in the production environment, leverage the multiple environments depicted in Figure 3 to test and perform quality assurance. This can be done via Choreo's default environments or pre-configured private environments.
Figure 3: Multi-environment deployment
In accordance with the concept of "build once, deploy anywhere," containers require environment-specific variables to run. These variables are typically introduced into containers via environment variables or mounted files. Choreo’s DevOps Portal allows you to effortlessly mount files and inject environment variables into your application for each environment as illustrated by Figure 4.
Figure 4: Configuration management
Choreo automatically recognizes the presence of an OpenAPI Spec in your repository and provides an API testing interface for testing your API as shown in Figure 5.
Figure 5: Rest API testing
Choreo's API management capabilities have been expanded to include components built with custom Dockerfiles, allowing you to manage the exposure of your APIs to consumers. This enables the configuration of API security settings, implementation rate limits, the association of usage plans, the provision of additional documentation, and the execution of additional API governance functions.
Choreo offers more functionality to both Ballerina and custom Dockerfiles through the DevOps portal, where you can set health checks, customize scaling rules, and view the observability of your application. More information about the DevOps portal can be found here.
You can easily bring an existing application that has a Dockerfile, or you can fork our sample applications repo in GitHub.
Head over to the Choreo Console and create a REST API, Scheduled Task, or Manual Trigger, which gives you the option to bring in a Dockerfile. This is shown in Figure 6.
Figure 6: Create component
Sign up to Choreo for free and try out this feature today!