We show that relatively simple integrated photonic circuits have the potential to realize a high fidelity deterministic controlled-phase gate between photonic qubits using bulk optical nonlinearities. The gate is enabled by converting travelling continuous-mode photons into stationary cavity modes using strong classical control fields that dynamically change the effective cavity-waveguide coupling rate. This architecture succeeds because it reduces the wave packet distortions that otherwise accompany the action of optical nonlinearities [J. Shapiro, Phys. Rev. A 73, 062305 (2006); J. Gea-Banacloche, Phys. Rev. A 81, 043823 (2010)]. We show that high-fidelity gates can be achieved with self-phase modulation in chi((3)) materials as well as second-harmonic generation in chi((2)) materials. The gate fidelity asymptotically approaches unity with increasing storage time for an incident photon wave packet with fixed duration. We also show that dynamically coupled cavities enable a trade-off between errors due to loss and wave packet distortion. Our proposed architecture represents a new approach to practical implementation of quantum gates that is room-temperature compatible and only relies on components that have been individually demonstrated.