Stop app from showing multiple icons in Dock

Apps with support for opening documents minimize into Dock in their own separate icon. To disable that behaviour, check Minimise windows into application icon under System Preferences → Dock.

macOS Mojave has a configuration to show recently used app's icon in the Dock (just like in iOS 11 and later). To disable it, uncheck Show recent applications in Dock under System Preferences → Dock.

enter image description here