For a compact example with countably many path components, take $X = \\{\frac{1}{n} \mid n \in \mathbb N\\} \cup \\{0\\}$ is such a space.
For a compact example with any given cardinal number, represent that cardinal number by a well ordered set $X$ that possess a maximal element, and use the order topology on $X$.
If you don't like examples in which the path components are all points, take the cartesian product of any of my examples $X$ with your favorite compact path connected set.