You do not need to build five stardocks. The only time you should be building more of these is if you are going deep into enemy territory, possibly with hostile planets in between your path and you need a forward base. To make them build faster, you can place an engineer (or many engineers) onto them, and it will build faster. Also, it could be that your income level is not high enough to support the kind of production you are looking for.
On the defensive side, since you know what is coming, set up a trap using your defensive structures and make sure that you have fighters as your primary replacement ship. You can control this by clicking on them a few times so that it builds five of them before it builds anything else.