My question is related to this question on copying files from containers to hosts; I have a Dockerfile that fetches dependencies, compiles a build artifact from source, and
You could bind a local path on the host to a path on the container, and then cp the desired file(s) to that path at the end of your script.
cp
$ docker run -d \ -it \ --name devtest \ --mount type=bind,source="$(pwd)"/target,target=/app \ nginx:latest
Then there is no need to copy afterwards.