In anticipation of the Gaia astrometric mission, a large sample of spectroscopic binaries has been observed since 2010 with the SOPHIE spectrograph at the Haute--Provence Observatory. Our aim is to derive the orbital elements of double-lined spectroscopic binaries (SB2s) with an accuracy sufficient to finally obtain the masses of the components with relative errors as small as 1 % when the astrometric measurements of Gaia are taken into account. In this paper we present the results from five years of observations of 10 SB2 systems with periods ranging from 37 to 881 days. Using the TODMOR algorithm we computed radial velocities from the spectra, and then derived the orbital elements of these binary systems. The minimum masses of the components are then obtained with an accuracy better than 1.2 % for the ten binaries. Combining the radial velocities with existing interferometric measurements, we derived the masses of the primary and secondary components of HIP 87895 with an accuracy of 0.98 % and 1.2 % respectively.