I would like to know if light is affected by gravity,
Yes, it is. Its motion is affected by gravity, and it also produces its own gravitational field. Its motion is affected by gravity because, in GR, the gravitational field is actually the geometry of spacetime. Analogous to Newton's first law, all small particles follow geodesics if they aren't acted on by other forces (gravity isn't a force in GR). The fact that the path of light bends when it's near a massive object was one of the first observational tests to determine if GR was an accurate theory.
We know light produces a gravitational field because light is composed of electromagnetic fields, and the stress-energy tensor of the EM field is nonzero.
also, I would like to know what is the more correct for the definition of gravity: A force that attracts bodies with mass or force that attracts bodies with energy, such as light.
If you're talking about Newtonian gravity, then the first definition is accurate. The second definition is wrong in both Newtonian gravity and GR. In GR gravity isn't a force at all; it's a consequence of the geometry of spacetime.
Is light massless afterall?
It depends on your definition of mass. The definition nearly everyone (physicists, chemists, engineers) uses is called "rest mass" or sometimes "invariant mass." It is defined by:
$$m=\frac{1}{c^2}\sqrt{E^2-p^2c^2}$$
where $E$ is total energy, $p$ is the magnitude of momentum, and $c$ is the speed of light. For light, this quantity is zero.
Some people still use a definition of mass that most people believe to be outdated and not particularly useful. It's called "relativistic mass," and is simply defined as:
$$m_{rel}=\frac{E}{c^2}$$
Since $E$ is total energy (including kinetic energy), this version of mass is actually frame-dependent and will increase with increasing velocity. This is rather inconvenient, but since the energy of a photon is nonzero the relativistic mass will also be nonzero.
PS: If you ever hear someone say mass increases with velocity, realize that they are talking about relativistic mass. Pop-sci books and TV shows love to start rambling about increasing mass, even though nobody really uses that definition of mass anymore. Rest mass is always the same at any velocity.