|
| 1 | +{ |
| 2 | + "min_packer_version": "1.8", |
| 3 | + "variables": { |
| 4 | + "azure_client_id": "{{env `AZURE_CLIENT_ID`}}", |
| 5 | + "azure_client_secret": "{{env `AZURE_CLIENT_SECRET`}}", |
| 6 | + "azure_tenant_id": "{{env `AZURE_TENANT_ID`}}", |
| 7 | + "azure_subscription_id": "{{env `AZURE_SUBSCRIPTION_ID`}}", |
| 8 | + "azure_location": "westeurope", |
| 9 | + "azure_vm_size": "Standard_D2s_v6", |
| 10 | + "build_prefix": "", |
| 11 | + "docker_version": "", |
| 12 | + "image_version": "" |
| 13 | + }, |
| 14 | + "builders": [{ |
| 15 | + "type": "azure-arm", |
| 16 | + "client_id": "{{user `azure_client_id`}}", |
| 17 | + "client_secret": "{{user `azure_client_secret`}}", |
| 18 | + "tenant_id": "{{user `azure_tenant_id`}}", |
| 19 | + "subscription_id": "{{user `azure_subscription_id`}}", |
| 20 | + "managed_image_resource_group_name": "dstack-resources-westeurope", |
| 21 | + "managed_image_name": "{{user `build_prefix`}}dstack-nvme-{{user `image_version` | clean_resource_name}}", |
| 22 | + "os_type": "Linux", |
| 23 | + "image_publisher": "canonical", |
| 24 | + "image_offer": "0001-com-ubuntu-server-jammy", |
| 25 | + "image_sku": "22_04-lts-gen2", |
| 26 | + "azure_tags": { |
| 27 | + "Name": "DSTACK" |
| 28 | + }, |
| 29 | + "location": "{{user `azure_location`}}", |
| 30 | + "vm_size": "{{user `azure_vm_size`}}" |
| 31 | + }], |
| 32 | + "provisioners": [ |
| 33 | + { |
| 34 | + "type": "shell", |
| 35 | + "inline": ["cloud-init status --long --wait"] |
| 36 | + }, |
| 37 | + { |
| 38 | + "type": "shell", |
| 39 | + "scripts": [ |
| 40 | + "provisioners/kernel/apt-upgrade.sh", |
| 41 | + "provisioners/kernel/apt-daily.sh", |
| 42 | + "provisioners/kernel/apt-packages.sh", |
| 43 | + "provisioners/kernel/kernel-tuning.sh" |
| 44 | + ] |
| 45 | + }, |
| 46 | + { |
| 47 | + "type": "file", |
| 48 | + "source": "provisioners/install-docker.sh", |
| 49 | + "destination": "/tmp/install-docker.sh" |
| 50 | + }, |
| 51 | + { |
| 52 | + "type": "file", |
| 53 | + "source": "provisioners/run-docker", |
| 54 | + "destination": "/tmp/run-docker" |
| 55 | + }, |
| 56 | + { |
| 57 | + "type": "shell", |
| 58 | + "inline_shebang": "/bin/sh -x", |
| 59 | + "inline": [ |
| 60 | + "cd /tmp", |
| 61 | + "chmod +x install-docker.sh", |
| 62 | + "./install-docker.sh --version {{user `docker_version`}}" |
| 63 | + ] |
| 64 | + }, |
| 65 | + { |
| 66 | + "type": "shell", |
| 67 | + "environment_vars": ["IMAGE_VERSION={{user `image_version`}}"], |
| 68 | + "script": "provisioners/pull-docker-images.sh" |
| 69 | + }, |
| 70 | + { |
| 71 | + "type": "shell", |
| 72 | + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'", |
| 73 | + "inline_shebang": "/bin/sh -x", |
| 74 | + "inline": ["/usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync"] |
| 75 | + } |
| 76 | + ] |
| 77 | +} |
0 commit comments