So far what I had understood about potential energy is that it is defined for a System (With at least two particles) with forces acting towards each other of same magnitude and ,
$$-W_\mathrm{conservative} = ΔU.$$

For example in case of gravitational potential energy ,we only consider work done on small body as there is negligible work done on the earth. 

But in case such as : The left side of a massless spring is attached to the wall, and there is a block attached to the right side of the spring. 

If we consider block + spring as our system then the the net work done by internal forces would be zero , So what is increasing the potential energy of the system then ?

I refer to this question - [Question][1]

According to some answer , I thought I need to consider the earth also into system and Spring just stores potential energy like gravitational field not really being the part of the system.

Is this reasoning correct? If not please help me clear these doubts.

 

  [1]: https://physics.stackexchange.com/q/553741/