Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Run Doctrine migrations automatically on container start

オープン 初心者向け
#309 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

@akramer-zibra がすでに取り組んでいます。

2026年10月15日 から。

  • #310 @akramer-zibra による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
66/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
docker, php, shell

調査の方向性

リポジトリのルートにある Dockerfile と Dockerfile-standalone、そして提案された entrypoint.sh が置かれる docker/configurations/ ディレクトリから始めてください。APP_ENV=prod の下で bin/console がどう動くかを確認します。スクリプトを追加し、両方の Dockerfile で ENTRYPOINT として組み込み、その後イメージをビルドしてコンテナを起動し、php-fpm や supervisord が起動する前にマイグレーションが実行されることを確認してください。新しいコンテナがマイグレーションを実行して起動し、docker run による CMD の上書きが引き続き渡されることが確認できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

feature request
Problem / motivation

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:

#!/bin/sh
set -e

php bin/console doctrine:migrations:migrate --no-interaction

exec "$@"

Wire it up in both Dockerfiles:

COPY ./docker/configurations/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh

# In Dockerfile
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["php-fpm"]

# In Dockerfile-standalone
ENTRYPOINT ["/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.
Alternatives considered

No response

Area

Docker / deployment

Additional context

No response

主要言語
PHP
スター
760
フォーク
45
平均マージ
1日 14時間
マージ済み PR(30日)
3

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

tchapi/davis のほかの issue

tchapi/davis の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。