add Packer config for creating Alibaba 18.04 image

This commit is contained in:
Jakub Sokołowski 2018-07-19 00:10:41 +02:00
parent 72d8ad5fc0
commit 20552dba2e
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
3 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,12 @@
# Description
This is for creating an Ubuntu 18.04 image for use in Alibaba Cloud.
As it stands today - 19/08/2018 - Alibaba has no official images for 18.04 so we have to make due.
# Usage
Just run:
```
packer build main.json
```
You might have to update the `source_image` if it's been a while.

View File

@ -0,0 +1 @@
DPkg::options { "--force-confdef"; "--force-confnew"; }

View File

@ -0,0 +1,45 @@
{
"variables": {
"access_key" : "{{env `ALICLOUD_ACCESS_KEY`}}",
"secret_key" : "{{env `ALICLOUD_SECRET_KEY`}}"
},
"builders": [
{
"type" : "alicloud-ecs",
"access_key" : "{{user `access_key`}}",
"secret_key" : "{{user `secret_key`}}",
"image_name" : "ubuntu_18_04_64_custom_20180718",
"source_image" : "ubuntu_16_0402_32_20G_alibase_20180409.vhd",
"region" : "cn-hongkong",
"ssh_username" : "root",
"instance_type" : "ecs.t5-lc2m1.nano",
"internet_charge_type" : "PayByTraffic",
"io_optimized" : "true"
}
],
"provisioners": [
{
"type": "file",
"source": "./apt.conf",
"destination": "/etc/apt/apt.conf"
},
{
"type": "shell",
"environment_vars": [
"DEBIAN_FRONTEND=noninteractive",
"DEBIAN_PRIORITY=critical"
],
"inline": [
"apt-get -y update",
"apt-get -o Dpkg::Options::=--force-confnew -y upgrade",
"apt-get -o Dpkg::Options::=--force-confnew -y dist-upgrade",
"apt-get -y autoremove --purge",
"apt-get -y autoclean",
"do-release-upgrade -d -f DistUpgradeViewNonInteractive",
"apt-get -y autoremove --purge",
"apt-get -y autoclean",
"echo '' > /etc/apt/apt.conf"
]
}
]
}