I just wanted to chip in and say, having resolved a similar problem, that in my case the issue was with volume mirroring that I had set up in an upstream docker compose file driving the dockerfile. In my case I was mirroring my local directory with the working folder (so that my local changes could be reflected live in the container, which I actually didn’t need…). The volume mirroring happens at run time after the copy commands in my dockerfile had run, and ends up replicating my local folder to the working folder in the container, wiping the copy commands run during the build. In this thread, I believe OP had the same issue.
So it’s a gotcha to watch for when working with dockerfiles and mounted volumes!