Bright sources of high energy electromagnetic radiation are widely employed in fundamental research as well as in industry and medicine. This steadily growing interest motivated the construction of several facilities aiming at the realisation of sources of intense X- and gamma-ray pulses. To date, free electron lasers and synchrotrons provide intense sources of photons with energies up to 10-100 keV. Facilities under construction based on incoherent Compton back scattering of an optical laser pulse off an electron beam are expected to yield photon beams with energy up to 19.5 MeV and peak brilliance in the range 10$^{20}$-10$^{23}$ photons s$^{-1}$ mrad$^{-2}$ mm$^{-2}$ per 0.1% bandwidth. Here, we demonstrate a novel mechanism based on the strongly amplified synchrotron emission which occurs when a sufficiently dense electron beam interacts with a millimetre thickness solid target. For electron beam densities exceeding approximately $3\times10^{19}\text{ cm$^{-3}$}$ filamentation instability occurs with the self-generation of 10$^{7}$-10$^{8}$ gauss magnetic fields where the electrons of the beam are trapped. This results into a giant amplification of synchrotron emission with the production of collimated gamma-ray pulses with peak brilliance above $10^{25}$ photons s$^{-1}$ mrad$^{-2}$ mm$^{-2}$ per 0.1% bandwidth and photon energies ranging from 200 keV up to several hundreds MeV. These findings pave the way to compact, high-repetition-rate (kHz) sources of short (30 fs), collimated (mrad) and high flux ($>10^{12}$ photons/s) gamma-ray pulses.