-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create template for cloud image for Azure
- Loading branch information
1 parent
7ad54c2
commit e98b05c
Showing
3 changed files
with
167 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Manual Azure build for STGN | ||
|
||
on: [workflow_dispatch] | ||
|
||
jobs: | ||
azure-image-build: | ||
defaults: | ||
run: | ||
working-directory: runner | ||
env: | ||
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} | ||
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }} | ||
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | ||
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | ||
strategy: | ||
matrix: | ||
variants: [ azure-image ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Download packer | ||
run: | | ||
wget https://releases.hashicorp.com/packer/1.8.0/packer_1.8.0_linux_amd64.zip | ||
unzip packer_1.8.0_linux_amd64.zip | ||
chmod +x packer | ||
cp -R ami/packer/* . | ||
- name: Run packer | ||
run: | | ||
VERSION=${{ github.run_number }} | ||
./packer build -var build_id=$VERSION ${{ matrix.variants }}.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
{ | ||
"min_packer_version": "1.8", | ||
"variables": { | ||
"azure_client_id": "{{env `AZURE_CLIENT_ID`}}", | ||
"azure_client_secret": "{{env `AZURE_CLIENT_SECRET`}}", | ||
"azure_tenant_id": "{{env `AZURE_TENANT_ID`}}", | ||
"azure_subscription_id": "{{env `AZURE_SUBSCRIPTION_ID`}}", | ||
"azure_location": "East US", | ||
"azure_vm_size": "Standard_DS2_v2", | ||
"build_id": "{{timestamp}}", | ||
"build_prefix": "stgn-", | ||
"docker_version": "20.10.17", | ||
"dstack_stage": "STGN" | ||
}, | ||
"builders": [{ | ||
"type": "azure-arm", | ||
"client_id": "{{user `azure_client_id`}}", | ||
"client_secret": "{{user `azure_client_secret`}}", | ||
"tenant_id": "{{user `azure_tenant_id`}}", | ||
"subscription_id": "{{user `azure_subscription_id`}}", | ||
"managed_image_resource_group_name": "packer", | ||
"managed_image_name": "{{user `build_prefix`}}dstack-{{user `build_id`}}", | ||
"os_type": "Linux", | ||
"image_publisher": "Canonical", | ||
"image_offer": "UbuntuServer", | ||
"image_sku": "18.04-DAILY-LTS", | ||
"azure_tags": { | ||
"Name": "DSTACK" | ||
}, | ||
"location": "{{user `azure_location`}}", | ||
"vm_size": "{{user `azure_vm_size`}}" | ||
}], | ||
"provisioners": [ | ||
{ | ||
"type": "shell", | ||
"inline": ["cloud-init status --long --wait"] | ||
}, | ||
{ | ||
"type": "shell", | ||
"scripts": [ | ||
"provisioners/kernel/apt-upgrade.sh", | ||
"provisioners/kernel/apt-daily.sh", | ||
"provisioners/kernel/apt-packages.sh", | ||
"provisioners/kernel/kernel-tuning.sh" | ||
] | ||
}, | ||
{ | ||
"type": "shell", | ||
"environment_vars": ["DSTACK_STAGE={{user `dstack_stage`}}"], | ||
"script": "provisioners/get-dstack-runner.sh" | ||
}, | ||
{ | ||
"type": "file", | ||
"source": "provisioners/install-docker.sh", | ||
"destination": "/tmp/install-docker.sh" | ||
}, | ||
{ | ||
"type": "file", | ||
"source": "provisioners/run-docker", | ||
"destination": "/tmp/run-docker" | ||
}, | ||
{ | ||
"type": "shell", | ||
"inline_shebang": "/bin/sh -x", | ||
"inline": [ | ||
"cd /tmp", | ||
"chmod +x install-docker.sh", | ||
"./install-docker.sh --version {{user `docker_version`}}" | ||
] | ||
}, | ||
{ | ||
"type": "shell", | ||
"script": "provisioners/docker-image-without-cuda.sh" | ||
}, | ||
{ | ||
"type": "shell", | ||
"inline_shebang": "/bin/sh -x", | ||
"inline": ["/usr/local/bin/dstack-runner --version"] | ||
}, | ||
{ | ||
"type": "shell", | ||
"inline_shebang": "/bin/sh -x", | ||
"inline": ["/usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync"] | ||
} | ||
] | ||
} |