Thermodynamics of a system of leptons, photons and interacting nucleons