We optimize a general model of bioprocesses, which is nonconvex due to the microbial growth in the biochemical reactors. We formulate a convex relaxation and give conditions guaranteeing its exactness in both the transient and steady state cases. When the growth kinetics are modeled by the Monod function under constant biomass or the Contois function, the relaxation is a second-order cone program, which can be solved efficiently at large scales. We implement the model on a numerical example based on a wastewater treatment system.