git clone https://garage44.eu/jeroen/midas.git.. /node/macos/node.pkr.hcl
# The macOS node image: a base macOS VM with Xcode, provisioned for midas.
# Written into the build directory by `midas setup` and run with Packer and
# Cirrus Labs' tart plugin, as the node's user. The base image's admin login
# (admin/admin) is used only here, and provision.sh takes it away at the end.
packer {
required_plugins {
tart = {
version = ">= 1.12.0"
source = "github.com/cirruslabs/tart"
}
}
}
variable "base" { type = string }
variable "name" { type = string }
variable "cpus" { type = number }
variable "memory_gb" { type = number }
variable "disk_gb" { type = number }
source "tart-cli" "node" {
vm_base_name = var.base
vm_name = var.name
cpu_count = var.cpus
memory_gb = var.memory_gb
disk_size_gb = var.disk_gb
ssh_username = "admin"
ssh_password = "admin"
ssh_timeout = "300s"
headless = true
}
build {
sources = ["source.tart-cli.node"]
# A source ending in "/" uploads the directory's contents into the
# destination, which must already exist: without this every file lands on
# one plain file called /tmp/midas-guest.
provisioner "shell" {
inline = ["mkdir -p /tmp/midas-guest"]
}
provisioner "file" {
source = "guest/"
destination = "/tmp/midas-guest"
}
provisioner "shell" {
inline = ["echo admin | sudo -S bash /tmp/midas-guest/provision.sh"]
}
}