You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Run Doctrine migrations automatically on container start #309
Currently, after docker pull + restart, migrations must be run manually:
docker exec -it davis sh -c "APP_ENV=prod bin/console doctrine:migrations:migrate --no-interaction"
If this step is forgotten, Davis boots fine but fails in confusing ways (PROPPATCH errors, address books that won't create, etc.) instead of refusing to start. Time spend for upgrading would also decrease with this automation.
Proposed solution
Bake a minimal entrypoint.sh into both docker images that runs migrations before the server starts, then execs the normal process:
COPY ./docker/configurations/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
# In DockerfileENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["php-fpm"]
# In Dockerfile-standaloneENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"] # Dockerfile-standalone
exec "$@" keeps it transparent to whatever CMD (or a docker run override) supplies.
Known limitations
No DB-ready retry: if the database isn't accepting connections yet on first docker-compose up, the migrate step fails fast and the container exits. Compose files don't currently gate depends_on on a healthcheck.
No concurrency lock: if the image is ever scaled to multiple replicas, each would race to run migrations on start. Not an issue for the single-instance docker-compose setups in this repo.
Activity
akramer-zibra commentedon Oct 15, 2026
PR (#310) also uses healthchecks on both postgres and mysql database containers to address "No DB-ready retry" aspect described above.