How to put an installation step in the first container execution

I want to write a Dockerfile for some web apps that do some installation steps that are specific to which instance before their first use, like initializing their databases, etc.

What is the recommended or most common way of doing that?