What you're describing is the particle in a box system, and for a 3D box the energy levels of this system are given by:
$$ E_{ijk} = \frac{\hbar^2\pi^2}{2mL^2}(n_i^2 + n_j^2 + n_k^2) \tag{1} $$
where $L$ is the size of the box. The numbers $n$ label the energy levels with $(1, 1, 1)$ being the lowest level and larger values of $n_i$, $n_j$ and $n_k$ giving higher energy levels.
The interesting thing about this system is that even in the lowest energy state, $(1, 1, 1)$, the energy is not zero. This is the phenomenon known as zero point energy, and a quick look at equation (1) shows that the magnitude of the zero point energy is inversely proportional to the size of the box squared:
$$ E_{111} = \frac{3\hbar^2\pi^2}{2m}\frac{1}{L^2} $$
So to you shrink the size of the box you have to put energy in by doing work on it. An electron is (as far as we know) a point particle and has no volume so to perfectly confine the electron would mean taking $L$ down to zero, and that would mean putting in an infinite amount of energy i.e. it can't be done.
The uncertainty principle comes in because the uncertainty in the electron's momentum scales roughly as the energy, so as $L \rightarrow 0$ the momentum uncertainty $\Delta p \rightarrow \infty$.
In fact even in principle we can't get $L$ smaller than about the Planck length, because at that point the energy density is so high that the system would form a black hole.