Thermodynamics and phase transition of a nonlinear electrodynamics black hole in a cavity