We present a Gaussian-basis implementation of orbital-free density-functional theory (OF-DFT) in which the trust-region image method (TRIM) is used for optimization. This second-order optimization scheme has been constructed to provide benchmark all-electron results with very tight convergence of the particle number constraint, associated chemical potential and electron density. It is demonstrated that, by preserving the saddle-point nature of the optimization and simultaneously optimizing the density and chemical potential, an order of magnitude reduction in the number of iterations required for convergence is obtained. The approach is compared and contrasted with a new implementation of the nested optimization scheme put forward by Chan, Cohen and Handy. Our implementation allows for semi-local kinetic-energy (and exchange-correlation) functionals to be handled self-consistently in all-electron calculations. The all-electron Gaussian-basis setting for these calculations will enable direct comparison with a wide range of standard high-accuracy quantum-chemical methods as well as with Kohn-Sham density-functional theory. We expect that the present implementation will provide a useful tool for analysing the performance of approximate kinetic-energy functionals in finite systems.