2 thoughts on “Packer and vagrant”

  1. Hello, [Homestead](https://github.com/laravel/homestead/) maintainer here.

    We use Packer to build Ubuntu 18.04 based off the [chef/bento](https://github.com/chef/bento) Packer configuration templates. We keep our custom provisioning script in [Settler](https://github.com/laravel/settler/).

    Our build process:

    * Check out master on chef/bento repo
    * Check out master on laravel/settler repo
    * run `./bin/copy-to-bento.sh` to copy our Homestead provision script to the Bento scripts folder.
    * Rename “cleanup.sh” to “homestead.sh” in the Ubuntu 18.04 JSON file.
    * Run `packer build –only= ubuntu-18.04-amd64.json`

    The output will be `builds/ubuntu-18.04..box` which is what I add to my local Vagrant and test. Once I’m happy with the build that box file gets uploaded to https://app.vagrantup.com/laravel/boxes/homestead for user’s to download and use.

    For your use case you could do the exact same thing. If you’re not using Ubuntu there are also other flavors in the Bento repo. Essentially what you want is to do all of the provisioning you can in the Packer stage so there is less to do when your end users run `vagrant up`.

    Hope this helps, happy to answer any questions. Reply

Leave a Comment