My starting point is:
- Raspberry Pi 4 Model B Starter Kit
- 16gb SD card (if you intend to have large docker images then go bigger)
- Ubuntu 20.04 installed on the Rasparry Pi
- Raspberry Pi Imager v1.2
- PuTTY for connecting remotely to the Pi from a laptop (Optional)
Check this link for details on creating your PAT token
Check this link for creating an App Pool
sudo apt install docker.io
sudo systemctl enable --now docker
Check that it installed
docker --version
-
Create a directory
makdir agent
and thencd agent
-
Create Dockerfile
nano Dockerfile
-
Copy and past the contents of the Dockerfile from this repo (it's in the linux-ARM directory)
-
Create start.sh file
nano start.sh
-
Copy and past the contents of the start.sh from this repo (it's in the linux-ARM directory)
-
Build the image
docker build -t dockeragent:latest .
Note: you may need to runsudo chmod 666 /var/run/docker.sock
to enable docker to run this command -
Run the image to create your container updayting the 2 variables for Project and PAT (Note my App pool is called SelfHosted so you many need to change that too)
sudo docker run --restart=always -e AZP_URL=https://dev.azure.com/<YourProject> -e AZP_TOKEN=<PAT TOKEN> -e AZP_POOL=SelfHosted -e AZP_AGENT_NAME=pi-agent1 --name DevopsAgent1 dockeragent:latest
I have used the --restart=always
so the container(s) will start automatically after a reboot. You can run multiple containers and get multiple agents if you wish, just change the AZP_AGENT_NAME
and --name
variables in step 7 above.
-
Remember that this build agent will have minimal capabilities. You can use tasks in your pipeline to install capabilites. For example, if you want dotnet then use the
Use .Net Core sdk
task at the begining of your pipeline - https://docs.microsoft.com/en-gb/azure/devops/pipelines/tasks/tool/dotnet-core-tool-installer?view=azure-devops -
Each time your container restarts you'll loose your cache
-
The agent will include terraform version 0.12.24 as you cannot install Terraform via the task from Azure Devops on ARM architecture