It may come as a shock that the Heisenberg uncertainty principle is not fundamentally a principle of the physical world. It is actually based on more fundamental properties of the mathematics in terms of which quantum mechanics is formulated. Due to this fact, provided that certain conditions apply, it does not really matter whether you consider the light between the mirrors as a single photon or whether you consider it as a classical field. The same principle applies.
Moreover, when there is no nonlinearity in the system, then whether you think of the setup as a classical system or as a quantum system does not matter, because they are described by the same mathematics.$^*$ So, if we ignore issues related to coherence, then a photon would be described by a wavefunction that is identical to classical field.
Now one can specify the wave function of the photon by some function that would be a solution of the Helmholtz equation with the boundary conditions. Then the positon and its uncertainty can be directly obtained from the definition of the wave function. The momentum and its uncertainty follows by computing the Fourier transform of the wave function.
For the case with the two mirrors, the field is periodic. It Fourier transform then produces a discrete spectrum. However, one can still compute an uncertainty in the usual way and it would still obey the Heisenber uncertainty principle.
In response to the request in the comment, I'll give a little more detail on how to do the calculations. It is really not too complicated. The idea is that the product of the width of the wave function and the width of its spectrum is always large than some constant
$$ \Delta x \Delta k \geq C . $$
Here, I consider the spatial domain. With the temporal domain, it is kind of obvious that the relationship would be satisfied if the duration of the signal is infinite. So, it simply comes down to calculating the width of the optical pulse frozen in time. So let's fix the time at a point where the pulse is halfway between the mirrors. The width can now be obtained by computing the centralized second moment
$$ \sigma_x^2 = \int |\psi(x)|^2 (x-\mu_x)^2 dx , $$
where $\mu_x$ represents the mean location of the wave function. Then we compute the Fourier transform of the wavefunction
$$ \Psi(k) = \int \psi(x) \exp(ikx) dx . $$
Note that this is the spatial domain Fourier transform only. It does not contain any information about the temporal behaviour since we've fixed the time to a specific value. A similar calculation then leads to the width of the spectrum
$$ \sigma_k^2 = \int |\Psi(k)|^2 (k-\mu_k)^2 dk . $$
The uncertainties are now given by the square roots of the variances $\Delta x = \sigma_x$ and $\Delta k = \sigma_k$.
The values of $\mu_x$ and $\mu_k$ are obtained from the first moments. For instance,
$$ \mu_k = \int |\Psi(k)|^2 k\ dk . $$
Let me know if I need to add more detail somewhere.
$^*$ One possible exception is when you are dealing with a complicated quantum states such as when it is entangled, but that is beyond the scope of the current question.