Defining such a variant:
dev: copies: [build] builder: command: ["ls", "-al"]
Results in the builder command being run before artifacts from the other build are copied over:
Step 23/28 : RUN ls "-al" ---> Running in 9147b648bf85 total 8 drwxr-xr-x 2 somebody somebody 4096 Dec 2 10:20 . drwxr-xr-x 1 root root 4096 Dec 2 10:20 .. Removing intermediate container 9147b648bf85 ---> a11db376693a Step 24/28 : COPY --chown=65533:65533 --from=build ["/srv/app", "/srv/app"]
As such, there is no way to run a builder command that depends on the local files.
The context is that I'm trying to reproduce this Dockerfile in Blubber: https://github.com/gi11es/thumbor-docker/blob/main/Dockerfile#L34
The highlighted line is one of the problematic steps to reproduce. It generates a random key file. This can't be run as the builder command of a variant, because it's multiple programs piped. I thought that as a workaround I could write a local Makefile instead, and call that from the builder command. Alas, the local Makefile won't get copied over to the container until after the builder command has run.
It would seem more logical to me that when defining that a variant copies files from another or from "local", that this steps happens before builder commands, as it would allow to access custom local files to build things.