{
    "variables": {
        "project": "",
        "tag": ""
    },
    "builders": [
        {
            "type": "googlecompute",
            "project_id": "{{user `project`}}",
            "source_image": "centos-7-v20210401",
            "ssh_username": "packer",
            "zone": "us-central1-a",
            "image_name": "centos-7-{{user `tag`}}",
            "image_description": "centos image with docker and cloud-init pre-installed",
            "image_storage_locations": [
                "us"
            ]
        }
    ],
    "provisioners": [
        {
            "type": "shell",
            "inline": [
                "sudo yum update -y",
                "sudo yum install -y yum-utils",
                "sudo yum -y install epel-release",
                "sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo",
                "sudo yum install -yy iptables docker-ce-20.10.6 docker-ce-cli-20.10.6 containerd.io socat nfs-utils logrotate jq wget cloud-init mdadm",
                "sudo systemctl enable cloud-init",
                "sudo echo \"PubkeyAuthentication yes\" | sudo tee -a  /etc/ssh/sshd_config",
                "sudo systemctl restart sshd",
                "sudo setenforce 0",
                "sudo sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config"
            ]
        }
    ]
}
