Multi-stage builds

51 views
Skip to first unread message

Max Weber

unread,
Oct 23, 2019, 9:06:56 AM10/23/19
to Packer
Hi,

has Packer any kind of build-in support for multi-stage builds, comparable to the one of Docker:


At the moment I'm building a base image and use this one to build the final image that contains my application. I only need to rebuild the base image, when I install or update Linux packages or make changes that should not be repeated on every normal build.

Best regards,

Max

Loup Kreidl

unread,
Dec 16, 2019, 8:59:27 AM12/16/19
to Packer
Hello,

This seems like an interesting idea to me!

I've an extra use case to add to Max's one:
We intend to use Packer to create our windows 10 ghost image and deploy it via PXE.

To do so, we start from an iso and a VmWareIso builder, we apply the windows updates (+one or two tweaks) in this first build. 
Then we start a new packer build with a VmWareOvf builder that takes the artifact generated above. During this build we run the meat of our provisionning (installing softs via salt-masterless).
And for the last build we also use the generated artifact but this time we are changing the VM's settings to boot via PXE so we can capture the VM.

Since the two first step can take a while (up to 8h cumulated) if I can split those steps and have a "valid" artifact generated at each I can use those to make tests/changes on the next "layer" without having to rerun the whole process.

We where wondering if packer could take another "packer-template" as a builder input and run successive builds by itself? (maybe this already exitst and we did not saw it?)
Or maybe we are taking the wrong direction here?

Best regards,
Loup

Rickard von Essen

unread,
Dec 18, 2019, 1:49:28 PM12/18/19
to packe...@googlegroups.com
No it doesn't have any built in support for multi stages. You have to have different template files and build them in series.

For VM images there isn't usually any reason to build in multiple stages. It's usually better to include "down streams" on the source level instead. 

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/925ff1e5-d1fa-4caf-85ad-db96c1a07be9%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages