[Docker] worktreeごとにCompose環境を並行起動できるようにしました - #2491
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
Git worktree ごとに Docker Compose 環境を並行起動できるようにしました。
従来はコンテナ名とホスト側ポートが固定されていたため、別の worktree から同時に起動するとコンテナ名やポートが重複していました。本変更では固定コンテナ名を廃止し、Compose のプロジェクト名による自動命名を利用します。また、Web、MySQL、MailHog、Dusk のホスト側ポートを worktree ごとに変更できる設定例を追加しました。
コンテナ間の MySQL 接続は従来どおり
db:3306を使用します。ホストからMySQLへ接続するポートだけをDB_FORWARD_PORTで変更できるようにし、アプリケーションのDB_PORTと役割を分離しました。レビュー完了希望日
軽微な開発環境の改善なので急ぎません。
関連Pull requests/Issues
なし
参考
次の2環境が同時に稼働できることを確認しました。
80、MySQL3306、MailHog80258081、MySQL33061、MailHog18025確認したコマンド:
worktree環境の
http://localhost:8081からHTTP 200 OKが返ることも確認しました。DB変更の有無
無し
チェックリスト