Armed with grenades and wearing explosives belts, three attackers entered the facility in Samarra, about 100 kilometres (62 miles) north of the capital, at 2:00 am, the official told AFP.
"They attacked the plant's workers, killing seven and wounding 12, according to an initial assessment," said the official, who spoke on condition of anonymity.
Security reinforcements then arrived on the scene, killing two of the bombers and evacuating the employees.
The attack comes as Iraqi Shiites mark the first day of the Eid al-Adha feast.
There was no immediate claim of responsibility for the attack, but the Islamic State jihadist group frequently carries out suicide bombings in Iraq.
In 2014, IS captured almost a third of Iraqi territory in a lightning offensive. It now only holds two pockets of territory in the country.