The Ancient Mesopotamian Epic of Gilgamesh, the oldest surviving written tablets of which are dated to 1800 BC, written in Akkadian (language of the Assyrians and Babylonians) and based on earlier Sumerian tales, includes a flood story that has differences from the Biblical story of Noah but enough similarities there is surely a common source.
In Gilgamesh, the first people could die in accidents or from violence but not from old age, so they had no natural limit to how long they could live. This meant that eventually the human population became so large that the noise of them disturbed the gods, most of whom therefore decided to get rid of mankind by drowning the lot of them in a world flood.
However, one god Ea thought differently and warned one man, Uta-Napishtim to build a boat in which to save himself and family, plus animals of every kind and also craftsmen of every trade so the knowledge of them would be preserved.
Once the flood, which had drowned everyone else, began to recede and Uta-Napishtim and his party found land, he made sacrifice to the gods, who had by then begun to miss the sacrifices that men used to make to them.
The gods then relented and let Uta-Napishtim and his party re-establish human society but this time on condition that everyone born from then on must be mortal, so the human population could never again grow too impossibly large.
In the Epic, the hero, Gilgamesh, centuries later, learns this story from Uta-Napishtim himself, who, since he and his wife were born in the days before the flood, have an unlimited lifespan, although hundreds of years old are still alive and living on an island at the end of the Earth.
So, much less moral content than the parallel Bible story of Noah, in which the flood is a punishment for Man's sins.