Few weeks back, I got a chance to go through IoT platform services provided by Azure and found that it is quite matured by the depth of service they provide. As a Devops Engineer, I always thought of building and deploying IoT Apps/Modules on a memory constraint environment because its bit more challenging than usual machine architecture. Being a great fan of Azure Devops Services, I decided to create a dockerized version of Az Devops Agent with necessary tools for building and deploying Azure IoT Modules baked in arm32v7 device architecture. I made extensive use of my RPi 4(4GB) for creating the ‘Golden’ image by trial and error in Alpine , but later moved to Ubuntu distribution as many of the libraries were not ready available in Alpine distribution and was taking time to find the appropriate libs.
The image is good to run in any arm32v7 devices as I build the image within the same device architecture and image consumes around .85 GB.
Steps to run the Azure Devops Agent
1. Need to get the PAT Token from Azure Devops Organization. Use the below link to generate the token from the menu. Please dont forget to change the <OrgName>
https://dev.azure.com/<OrgName>/_usersSettings/tokens
2. Pull the image from the Docker Hub
docker pull mysticrenji/azdevopsagent-iotedge
3. Once you pull the image snd get the PAT, you use the below commands to run the container
docker run -e AZP_URL={AZ DEVOPS URL} -e AZP_TOKEN={PAT} -e AZP_AGENT_NAME={AGENTNAME} -v /var/run/docker.sock:/var/run/docker.sock {ImageName}
where,
- AZ DEVOPS URL ->
https://dev.azure.com/<OrgName>
- PAT -> Personal Access Tokens
- AGENTNAME -> Any suitable Agent name. By default this new agent would be mapped under Default Agent pools. To change this behavior, need to change the start.sh script in the github repo and build the image
- ImageName – Name of the image
And my Pipeline for building and deploying Azure IoT Module would roughly look like this.
Yep, thats all. Try it and please let me know , if you are stuck with something.
The dockerfile and the related scripts has been placed at this Github repo and also at the DockerHub
Originally taken the post from the blog here