I have a Dockerfile in a remote repository with multi-stage builds. The first stage is for building the application. The second stage is for copying and using built artifacts from the first stage and creating the actual image for the application.
During the first stage, I need to modify the configuration (package.json) to set a homepage for the static files to be served from. But, I cannot modify the Dockerfile and I don't want to create a copy of it and insert code inside the first stage to modify the configuration.
I tried to use Dockerfile ONBUILD command, to insert a trigger that runs before starting to build the image, but since this is a multi-stage build, docker applies this build trigger to the second stage build, instead of the first one. How can I force it to apply the build trigger to the first build stage?