There are a couple of ways to go about this. The simplest way, if you're using Docker Compose, is to just have a folder (say modules) with the third-party modules you'd like to add. Then, simply bind-mount the individual modules into place under /usr/local/bin/user-lib/modules. It might look something like this:
Then, when you launch the services, they'll load that module alongside the others that are in that folder (from the base image). Combine this with the GATEWAY_MODULES_ENABLED environment variable to whitelist the other built-in modules as desired.
In the example above, modules is a folder on the host system (relative to where the docker-compose.yml file is located) where you're keeping the third-party modules you're then linking into the container.