diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ff86744 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.*.json +*.sw* diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7f7ccd6 --- /dev/null +++ b/Makefile @@ -0,0 +1,16 @@ + + + +validate: + for t in $(shell find . -iname "*.packer.json" -type f); do \ + ./scripts/packer validate --var-file=.azure.json $$t; \ + done; + +all: validate + for t in $(shell find . -iname "*.packer.json" -type f); do \ + ./scripts/packer build --var-file=.azure.json $$t; \ + done; + + + +.PHONY: all validate clean diff --git a/docker-ubuntu/docker-ubuntu.packer.json b/docker-ubuntu/docker-ubuntu.packer.json new file mode 100644 index 0000000..618e204 --- /dev/null +++ b/docker-ubuntu/docker-ubuntu.packer.json @@ -0,0 +1,44 @@ +{ + "builders" : [ + { + "type": "azure-arm", + + "subscription_id": "{{user `azure_subscription_id`}}", + "client_id": "{{user `azure_client_id`}}", + "client_secret": "{{user `azure_client_secret`}}", + "tenant_id" : "{{user `azure_tenant_id`}}", + + "resource_group_name": "azureagents-for-codevalet", + "storage_account": "codevaletvhds", + + "capture_container_name": "images", + "capture_name_prefix": "packer", + + + "os_type": "Linux", + "image_publisher": "Canonical", + "image_offer": "UbuntuServer", + "image_sku": "16.04-LTS", + + "location": "East US 2", + "vm_size": "Standard_A4" + } + ], + "provisioners" : [ + { + "type" : "shell", + "inline" : [ + "curl -sSL https://get.docker.com | bash", + "sudo apt-get install -qy git make default-jdk" + ] + }, + { + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'", + "inline": [ + "/usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync" + ], + "inline_shebang": "/bin/sh -x", + "type": "shell" + } + ] +}