Build a Docker image from Azure DevOps
Build and push a Docker image from Azure DevOps to the AWS Elastic Container Registry (ECR)
Use DuploCloud service account authentication to build and push a Docker image from Azure DevOps to the AWS Elastic Container Registry (ECR). You can use ECR regardless of where your app is hosted.
Avoid using capital letters when referencing a DuploCloud construct, such as a Tenant, even when the UI displays the string as all capital letters. Don't specify DEV01 for example, specify dev01.
Building and Pushing to the ECR
To build a Docker image and push it to the ECR, use a pipeline script. The script:
Logs you into AWS ECR, using Just-In-Time credentials from DuploCloud.
Builds and tags the Docker image. The tag name is based on the
git commit
SHA (Simple Hashing Algorithm).Pushes the Docker image to the ECR.
Example Pipeline Script
Here is an example Azure DevOps pipeline that builds a Docker image and pushes it to ECR.
Test and code coverage steps are commented to aid in getting started quickly with .NET apps. you can remove them for clarity.
Prerequisites to use the example script without modification
DUPLO_TOKEN
,DUPLO_HOST
, andECR_BASE
need to be pre-configured in the Azure DevOps variable group namedduplocloud-secrets
.The ECR must have the same name as the Azure DevOps repo being built. Modify the name of the ECR, if needed.
A
Dockerfile
must exist for the application in yoursrc
folder
These prerequisites can be customized to fit existing pipelines and conventions for passing YAML attribute values. Test and code coverage steps are included for illustration purposes. They are not required to publish an image to an ECR.
Example Code
Last updated