David Kimura PRO said 8 months ago on Docker on Rails 7 :
I would have a separate Dockerfile for the production image. In my case, if I do deploy to an x86 production environment, I would need to build the image anyways. I would do this in my CI/CD platform, but if I had to do it on my local machine (Apple Silicon SoC) then I would have to emulate the x86 CPU. So, between this and needing to have entrypoints, commands, or exposing ports, I would rather have a bit of duplication between dockerfiles and have separate environment specific ones.

Side note, this is the command that I use to build for different platforms and CPUs. 

docker buildx build -f Dockerfile --platform linux/amd64 -t registry/app_name:tag --push .