This is a known behavior with Next.js standalone output. The .env files are copied because Next.js needs them at runtime to provide environment variables to the application.
outputFileTracingExcludes is for to excluding files from dependency tracing and shouldn’t affect this at all
The standalone output needs to be self-contained with all necessary files for runtime, which means if you provide a .env file for environment variables then that becomes an expected file to run it. If you have an alternative way to provide environment variables at runtime (as you should and do), the output process doesn’t know about that.
If your environment variables are already available in the build environment, you should be able to delete the .env file before running the build and then Next.js will not copy it into the output directory
If you do need to read it while building the docker image, I’d recommend deleting the .env file in your Dockerfile immediately after your Build layer