Right triangle $ACD$ with right angle at $C$ is constructed outward on the hypotenuse $\overline{AC}$ of the $30^\circ$-$60^\circ$-$90^\circ$ triangle $ABC$, which has its right angle at $B$, $\angle BAC=30^\circ$ and $BC=2$, so that the two triangles have equal perimeters. What is $CD$?