Using the combination of density functional theory and many-body perturbation theory, we comprehensively investigate the electronic and optical properties of monolayer and bilayer CuI. For the bilayer, we build three high-symmetry stacking configurations i.e. AA, AB, and AC. The results reveal that monolayer CuI is a semiconductor with a direct band gap of 4.03 eV while the band gap of bilayer CuI is 1.62, 1.69, and 1.62 eV for AA, AB, and AC stacking configurations, respectively. The optical responses achieved from the Bethe-Salpeter equation are equal for light polarized along the x- and y-directions. The exciton binding energy of monolayer CuI is calculated to be 0.99 eV while it is 0.57, 0.59, and 0.56 eV for AA, AB, and AC stacking configurations, respectively. The maximum extinction coefficient of monolayer CuI is located in the ultraviolet area. Although, for the bilayers, the maximum extinction coefficient appears in the middle of the visible area. Overall, it is understood that the optoelectronic performance of the CuI binary compound improves from monolayer to bilayer. Because the AA configuration is more stable than the other two configurations, it is predicted to be the most suitable candidate for optoelectronic applications such as solar cells, photodetectors, and light-emitting diodes.