A continuous beam laser bores a hole in its target. The hole fills with ablated material from deeper in the hole and this heats up blocking the beam. That increases the pressure in the hole, which makes the hole wider, but the material in the hole stops the beam ablating any more. Eventually (after a few microseconds) enough material escapes from the hole to allow the beam to burn a little deeper and the process repeats. A burst or pulse laser will create a hole just as deep but take less energy, because while the beam is off the ablated material can escape from the hole. However, this scenario only applies to static beams fired at static targets. Moving targets or moving weapons are a whole other story.
A laser fired from a moving weapon at a moving target, especially one kilometres away, is going to skitter across the surface of the target burning shallow channels into the armour. Once the armour fails, the ablated material (now a very hot, highly conductive plasma) will spray around the internal components of the ship, not just burning them but also shorting out the electrical systems, possibly damaging them temporarily (until they reset, maybe?). What it won't do is deep penetration damage until the armour is full of holes. It will however, transfer a lot of heat to the target.
However, if the amount of energy put into a laser beam was used instead to accelerate a mass it would reach enormous velocities and transfer all of that energy to the target very very quickly. It would do far more damage on impact than the laser alone ever would. Why? Consider: 21 megajoules is also 21 megawatt/seconds which is equivalent to 6 Kilowatt/hours - the energy that 6 one-bar electric fires put out in an hour, all released in a single second. That's a lot, but its almost nothing compared to the same amount of energy in a kinetic kill weapon (a rail gun).
One joule is a force of one newton. One newton accelerates a one kilogram mass by one metre per second. 21 megajoules would accelerate a one kilogram mass to 21 million metres per second - 7% of light speed! Imagine that energy used to accelerate a cannon ball 3 inches across - whatever it hits would receive that much energy not in a second (and skittering over the moving surface), but in less than a microsecond and all in one place as the cannon ball hits. No armour, no material at all, can take that. After impact the projectile (and some of the armour) would become a high energy plasma blasting though the target at a million metres per second, along with a flash of heat energy (actually probably hard x-rays). The damage would spread out in a cone from the impact point. Nothing material could stop it until it had passed through a lot of stuff dissipating most of its energy.