So hold on, Horus, and wait a minute. If that was the smart move to do, don't you think that everyone would be doing it? One good look at military aircraft development tells me that this isn't necessarily a good idea. This idea works for some specialty platforms, but even then it's pretty expensive.
The first problem is visibility. In space, there's nowhere to hide. Everyone can see you from a million miles away. Victory goes to the side who sees the best while hiding the best. So any decent military fleet will be designed around stealth, making them hard to see, and sensors, making the enemy easier to see. By the time that you get around to hurling incomprehensibly powerful weaponry about, the battle is probably settled.
What we know about stealth is that stealth must be incorporated into a design from the drawing board. You can't retro-apply stealth. Stealth is so important that it makes all other design considerations secondary. Stealth dictates all other systems.
When we look at a freighter, we look at a vehicle designed to transport cargo. It's job is to move as many tons as efficiently as possible. It's second job is to be seen. Yes, you read correctly. As there were be huge numbers of freighters moving on and off a world, you need traffic control on them so that they don't collide into each other. For this style of ship, visibility isn't a downside, it's a necessary asset. So if you take this thing optimized for visibility and cargo hauling, then attempt to make it optimized for non-visibility and weapon launching, you will find yourself in two pits even before you begin reaching for the sky. Of course you can apply stealth to your ship, but that will cost money, take time to install, and not work effectively.
The second advantage that military vehicles have over civilian vehicles if fire control. No, I'm not talking about aiming and shooting, I'm talking about what happens after the ship gets hit. Military ships are designed to account for battle damage, having all sorts of systems to handle mishaps. Civilian ships just don't have the same sorts of systems. That means that when your freighter gets hit, if you haven't installed such a system, you're likely to suffer far worse damage than an equivalent military starship. Of course, you can spend the money to install such a system, but now you're spending more money and waiting for more equipment to get installed, and likely replacing otherwise useful equipment with equipment designed to handle combat damage.
Any military starship will need software. What military do you imagine that will authorize you to run its software? None. You'll need to spend large amounts of money for such software on the secondary market, and because the military likes to keep secrets, this software won't be compatible with your own allied military software. Good luck getting targeting data in realtime.
If you want to modify your ship in wartime, you'll run into the additional problem that all the arms factories will be busily selling to the military and not to you. In addition, their modification experts will be working for the military. Even freelance starship refurbishers will likely be working for the military. Meanwhile, you'll need to find someone who can do the modifications on the secondary market, or at least a place with the equipment to handle the work. Those place will be stacked up for business as well because everyone who can't get into the military contracted businesses will be patronizing the non-military businesses.
If the military is in need of freighters and other starships, they'll be busily buying up and modifying existing stocks of the types most useful to them. (The military needs to move freight and people, too.) There may even be laws that force you to sell your ship to the military if it's useful to them. The cream of the crop will go to the military because the military pays cash and carries big guns. You're likely to have a ship that the military doesn't want.
We haven't gotten into the power requirements for a military starship yet. If you're using energy weapons, you're going to need more power than you've got, and that will require replacing the power plants along with all the electrical connections. Those are big bucks and those take time. If you need military grade shields, those too.
Time is a big factor here. You'll need to locate a contractor, locate parts, design your system, pull the old systems, install the new, and debug them. That is a non-trivial space of time. Expect to spend a fortune in parts and labor.
At the end of all that, you'll most likely have the exact type of starship that a military absolutely doesn't want. Or maby they'll use all your clever overkill on convoy duty.