Use A Makefile To Build Container Images
I recently replatformed the site from the Digital Ocean app engine to a Hetzner VPS. I wrote about why I migrated off of Digital Ocean here. I decided to use Caddy as the web server because it made getting up and running with TLS nice and easy. During the migration, my domain's A and AAAA records were still pointed at the live Digital Ocean site so Caddy was not able to do the normal ACME style challenge with Let's Encrypt when creating my TLS certificates. Instead, I had to do a DNS challenge so I would not disturb my A and AAAA records. The DNS challenge with Caddy requires that you build a custom container image with the needed functionality specific to your registrar.
I used a Makefile with some well-structured targets and "stamp files" to generate a tar of the Caddy container image, and to deploy and install that image to my remote server. I was able to ensure that if the underlying containerfile was changed, then a new container image would be created, exported to a tar file, uploaded to my server, and then installed on my remote server. Make is able to navigate the dependency graph of your targets, and only perform the minimally required actions needed to get to a goal. Had I written a script to do all of this, I'd be building and deploying a container image every time - or even worse - I could miss a step. Now, I just type 'make' in the terminal and I don't have to think about what step requires what. Fantastic.
I'll explain how I strucutred my Makefile to get this done.