Here is the most basic way it works (until the gym rework).
First you need to catch level 1 Gastly (usually 11-12 CP) with Astonish as it’s main attack. Then you have to power it up once until it’s level is 24-26 CP.
Secondly you need to catch new Gastly, also level 1, CP 12, with Lick.
Now all you need is 5 more <12 CP Pokemons and you are ready.
Go to a gym.
Take it down.
Put 24-26 CP Gastly with Astonish inside.
Choose team like: <12 CP Gastly with Lick and 5 Pokemons with same or lower CP then your Gastly.
If you did everything correctly you should have won 1000 prestige with that gym battle without any of your Pokemon getting hurt. So you can do it again and again.
Leveling up gym really fast without need for any potions.
tbh I don’t know why don’t they just remove bubblestrat method forever. And it’s so easy to do. If level 4 and below players can’t enter gyms. Why can Pokemons level 4 and below be in a gym?