{
  "variables": {
    "token": "{{env `DIGITALOCEAN_TOKEN`}}",
    "image_name": "budibase-marketplace-snapshot-{{timestamp}}",
    "apt_packages": "jq"
  },
  "builders": [
    {
      "type": "digitalocean",
      "api_token": "{{user `token`}}",
      "image": "docker-20-04",
      "region": "lon1",
      "size": "s-1vcpu-1gb",
      "ssh_username": "root",
      "snapshot_name": "{{user `image_name`}}"
    }
  ],
  "provisioners": [
    {
      "type": "shell",
      "inline": [
        "cloud-init status --wait"
      ]
    },
    {
      "type": "file",
      "source": "files/etc/",
      "destination": "/etc/"
    },
    {
      "type": "file",
      "source": "files/var/",
      "destination": "/var/"
    },
    {
      "type": "shell",
      "environment_vars": [
        "DEBIAN_FRONTEND=noninteractive",
        "LC_ALL=C",
        "LANG=en_US.UTF-8",
        "LC_CTYPE=en_US.UTF-8"
      ],
      "inline": [
        "apt -qqy update",
        "apt -qqy -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' full-upgrade",
        "apt -qqy -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' install {{user `apt_packages`}}"
      ]
    },
    {
      "type": "shell",
      "environment_vars": [
        "application_name={{user `application_name`}}",
        "application_version={{user `application_version`}}",
        "DEBIAN_FRONTEND=noninteractive",
        "LC_ALL=C",
        "LANG=en_US.UTF-8",
        "LC_CTYPE=en_US.UTF-8"
      ],
      "scripts": [
        "scripts/90-cleanup.sh",
        "scripts/99-img_check.sh"
      ]
    }
  ]
}