The fire was reported at 5:20 a.m. at the Sterling Foods facility at 33300 Western Ave., near Pacific Street.
The Texas-based company produces cakes, bread, muffins, bagels and other treats like cookies and brownies. The Union City plant operates 24 hours a day.
Alameda County fire spokeswoman Aisha Knowles said there were 25 employees working at the time the fire started, and all were able to get out safely.
When firefighters arrived, they found thick smoke throughout the plant and a "small amount of fire that had reached through the roof," Knowles said.
The building's sprinkler system had activated, and crews were able to control the blaze in about 40 minutes, she said. As of 7:30 a.m., most fire crews had left the scene.
"Prior to them leaving, they assisted some of the employees in removing water from the facility," Knowles said.
No injuries were reported, and the cause of the fire remains under investigation.
The plant is now closed, and Knowles said the company will work with its insurance company and the health department to determine whether certain areas of the facility are still operational.
"They do have a sister plant in Azusa that they are working with to fill the orders that they will not be able to fill today as a result of the fire," she said.