Integrated sensing and communication (ISAC) has been envisioned as a promising technique to alleviate the spectrum congestion problem. Inspired by the applications of reconfigurable intelligent surface (RIS) in dynamically manipulating wireless propagation environment, in this paper, we investigate to deploy a RIS in an ISAC system to pursue performance improvement. Particularly, we consider a RIS-assisted ISAC system where a multi-antenna base station (BS) performs multi-target detection and multi-user communication with the assistance of a RIS. Our goal is maximizing the weighted summation of target detection signal-to-noise ratios (SNRs) by jointly optimizing the transmit beamforming and the RIS reflection coefficients, while satisfying the communication quality-of-service (QoS) requirement, the total transmit power budget, and the restriction of RIS phase-shift. An efficient alternating optimization algorithm combining the majorization-minimization (MM), penalty-based, and manifold optimization methods is developed to solve the resulting complicated non-convex optimization problem. Simulation results illustrate the advantages of deploying RIS in ISAC systems and the effectiveness of our proposed algorithm.