Allow volumes on build
Being able to mount a volume for build commands would allow doing some nice caching for things like node_modules with artifacts, I believe.
Alternatively, I think this PR would solve it another way: https://github.com/buildkite-plugins/docker-compose-buildkite-plugin/pull/271
We would definitely make use of this. Our current workaround for this build images that need other images' data is to copy node_modules and Ruby gems installed in other images like this:
COPY --from=yarn /app/node_modules /app/node_modules
This works, but it's slower
The docker documentation of the build command doesn't show an option to mount a volume at build time so there is no way to implement this in the plugin :(
Apparently, the right way to do this would be using multi-stage builds and COPY stanzas. Unless you are using buildkit, in which case most of the options to allow for this are to be added as part of the Dockerfile and not the command to execute the build.
Will close unless anyone can think of a way to help with this issue that is not related to buildkit (that is issue #256)