Skip to content

Instantly share code, notes, and snippets.

@bureado
Last active July 31, 2017 21:48
Show Gist options
  • Save bureado/cf2ab22185cbaa090f20162837fa2cf9 to your computer and use it in GitHub Desktop.
Save bureado/cf2ab22185cbaa090f20162837fa2cf9 to your computer and use it in GitHub Desktop.
Dockerfile and ARM template for Debian package builder in ACI example
# Dockerfile
FROM debian:sid
MAINTAINER Jose Miguel Parrella <[email protected]>
RUN echo deb-src http://ftp.us.debian.org/debian/ sid main >> /etc/apt/sources.list
RUN apt update
RUN apt -y install devscripts
RUN apt clean
COPY builder.sh /usr/local/bin
ENTRYPOINT ["/usr/local/bin/builder.sh"]
# builder.sh
#!/bin/sh
pkg=$1
echo "Building package $1..."
mkdir -p /packages/$pkg
apt-get build-dep $pkg -y && apt-get source $pkg --compile -y
cp *.deb /packages/$pkg
# parameters.json
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storageaccountname": {
"value": "..."
},
"storageaccountkey": {
"value": "..."
},
"imageRegistryLoginServer": {
"value": "....azurecr.io"
},
"imageRegistryUsername": {
"value": "..."
},
"imageRegistryPassword": {
"value": "..."
}
}
}
# template.json
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storageaccountname": {
"type": "string"
},
"storageaccountkey": {
"type": "securestring"
},
"imageRegistryLoginServer": {
"type": "string"
},
"imageRegistryUsername": {
"type": "string"
},
"imageRegistryPassword": {
"type": "securestring"
}
},
"resources":[{
"name": "[deployment().name]",
"type": "Microsoft.ContainerInstance/containerGroups",
"apiVersion": "2017-08-01-preview",
"location": "[resourceGroup().location]",
"properties": {
"containers": [{
"name": "builder",
"properties": {
"image": "...",
"command": [
"/usr/local/bin/builder.sh",
"[deployment().name]"
],
"volumeMounts": [{
"name": "packages",
"mountPath": "/packages/"
}],
"resources": {
"requests": {
"cpu": 4.0,
"memoryInGb": 8.0
}
}
}
}],
"osType": "Linux",
"imageRegistryCredentials": [{
"server": "[parameters('imageRegistryLoginServer')]",
"username": "[parameters('imageRegistryUsername')]",
"password": "[parameters('imageRegistryPassword')]"
}],
"volumes": [{
"name": "packages",
"azureFile": {
"shareName": "...",
"storageAccountName": "[parameters('storageaccountname')]",
"storageAccountKey": "[parameters('storageaccountkey')]"
}
}
]
}
}]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment