We experimentally investigate the thermocapillary migration induced by local laser heating of the advancing front of a growing droplet confined in a microfluidic channel. When heating implies an effective increase in interfacial tension, the laser behaves as a "soft door" whose stiffness can be tuned via the optical parameters (beam power and waist). The light-driven thermocapillary velocity of a growing droplet, which opposes the basic flow, is characterized for different types of fluid injection, either pressure or flow rate driven, and various channel aspect ratios. Measurements are interpreted using a simplified model for the temperature gradient at the interface, based on a purely diffusive, three-layer system. Considering the mean temperature gradient, we demonstrate that the classical large-scale temperature gradient behavior is retrieved in the opposite case when the thermal gradient length scale is smaller than the droplet size. We also demonstrate that the thermocapillary velocity is proportional to the smallest droplet curvature imposed by the channel confinement. This suggests that the thermocapillary velocity is in fact proportional to the mean temperature gradient and to the largest interface curvature radius, which both coincide with the imposed one and the spherical droplet radius in large-scale and unconfined situations. Furthermore, as used surfactant concentrations are largely above the critical micelle concentration, we propose a possible explanation, relying on state-of-the-art considerations on high-concentration surfactant-covered interfaces for the observed effective increase in interfacial tension with temperature. We also propose a mechanism for explaining the blocking effect at the scaling-law level. This mechanism involves the temporal evolution of hydrodynamic and thermocapillary forces, based on experimental observations. We finally show that this optocapillary interaction with a microfluidic droplet generator allows for controlling either the flow rate (valve) or the droplet size (sampler), depending on the imposed fluid injection conditions.