Docker with opam

Hello,

I usually use esy for development but I want to get into opam for different reasons (trying flambda more easily, larger userbase etc).

My question is then, how do I build docker containers with opam? Specifically handling depexts for statically linking.

In esy we have a bunch of packages packaged for esy so that they are available in the sandbox which makes it very easy.