Two changes do most of the work: a multi-stage build, and Next's standalone output.
Set this in next.config.ts:
Then only copy the traced runtime into a slim final stage:
That typically lands around 150MB. Add a .dockerignore with node_modules and .next so the build context stays small too.