Docker Compose + Rails: best practice to migrate?

From https://docs.docker.com/engine/reference/builder/#cmd:

If you would like your container to run the same executable every time, then you should consider using ENTRYPOINT in combination with CMD. See ENTRYPOINT

https://docs.docker.com/engine/reference/builder/#entrypoint

tl;dr

You could define an entrypoint under app and define a bash file there:

app:
  entrypoint: [bin/entry]
  ..

bin/entry file example:

#!/bin/bash
set -e

rake db:create
rake db:migrate

exec "$@"

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)