Start the server and respond 503 every time when your database and other dependencies are not ready. Couldn’t be easier.
version: '3' services: mysql: image: mysql:8.0
app:
build: .
command: is_ready --timeout 10 --addr mysql:3306 -- <run migrations command>
For cases like this, returning 503 every time the database is not ready, is not very convenient.