Measurements are presented of electroweak boson production using data from $pp$ collisions at a centre-of-mass energy of $\sqrt{s} = 8\mathrm{\,Te\kern -0.1em V}$. The analysis is based on an integrated luminosity of $2.0\mathrm{\,fb}^{-1}$ recorded with the LHCb detector. The bosons are identified in the $W\rightarrow\mu\nu$ and $Z\rightarrow\mu^{+}\mu^{-}$ decay channels. The cross-sections are measured for muons in the pseudorapidity range $2.0 < \eta < 4.5$, with transverse momenta $p_{\rm T} > 20{\mathrm{\,Ge\kern -0.1em V\!/}c}$ and, in the case of the $Z$ boson, a dimuon mass within $60 < M_{\mu^{+}\mu^{-}} < 120{\mathrm{\,Ge\kern -0.1em V\!/}c^{2}}$. The results are \begin{align*} \sigma_{W^{+}\rightarrow\mu^{+}\nu} &= 1093.6 \pm 2.1 \pm 7.2 \pm 10.9 \pm 12.7{\rm \,pb} \, , \sigma_{W^{-}\rightarrow\mu^{-}\bar{\nu}} &= \phantom{0}818.4 \pm 1.9 \pm 5.0 \pm \phantom{0}7.0 \pm \phantom{0}9.5{\rm \,pb} \, , \sigma_{Z\rightarrow\mu^{+}\mu^{-}} &= \phantom{00}95.0 \pm 0.3 \pm 0.7 \pm \phantom{0}1.1 \pm \phantom{0}1.1{\rm \,pb} \, , \end{align*} where the first uncertainties are statistical, the second are systematic, the third are due to the knowledge of the LHC beam energy and the fourth are due to the luminosity determination. The evolution of the $W$ and $Z$ boson cross-sections with centre-of-mass energy is studied using previously reported measurements with $1.0\mathrm{\,fb}^{-1}$ of data at $7\mathrm{\,Te\kern -0.1em V}$. Differential distributions are also presented. Results are in good agreement with theoretical predictions at next-to-next-to-leading order in perturbative quantum chromodynamics.