Skip to content

chore: docker compose build で PHP バージョンを TAG で切り替え可能にする#6813

Merged
dotani1111 merged 2 commits into
EC-CUBE:4.4from
nanasess:feature/compose-build-section
Jun 10, 2026
Merged

chore: docker compose build で PHP バージョンを TAG で切り替え可能にする#6813
dotani1111 merged 2 commits into
EC-CUBE:4.4from
nanasess:feature/compose-build-section

Conversation

@nanasess

@nanasess nanasess commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

概要(Overview・Refs Issue)

ec-cube2 の EC-CUBE/ec-cube2#1405 と同様に、docker compose build で環境変数 TAG を指定するだけで任意の PHP バージョンのイメージをローカルビルドできるようにします。これまで必要だった手動の docker build + docker tag の手順を不要にします。

方針(Policy)

  • feat(docker): docker compose で別バージョンタグをビルド可能にする ec-cube2#1405 にならい、ec-cube サービスに build セクションと pull_policy: missing を追加
  • build.args.TAGimage のタグと同じ環境変数 ${TAG:-8.1-apache} で共有し、ビルドするタグと付与されるイメージ名を常に一致させる
  • pull_policy: missing により、通常の docker compose up は従来どおり registry (ghcr.io) からイメージを取得する挙動を維持

実装に関する補足(Appendix)

変更は docker-compose.yml のみです。

    build:
      context: .
      args:
        TAG: ${TAG:-8.1-apache}
      pull: true
    pull_policy: missing

手動ビルド用のコメントも環境変数ベースの手順に置き換えています。

TAG=8.3-apache docker compose build
TAG=8.3-apache docker compose build --no-cache
TAG=8.3-apache docker compose up -d --build

DB バックエンドを指定する場合は COMPOSE_FILE と併用します。

COMPOSE_FILE=docker-compose.yml:docker-compose.pgsql.yml TAG=8.3-apache docker compose build

テスト(Test)

docker compose config で構成が正しく解決されることを確認済みです。

  • デフォルト: args.TAG: 8.1-apache / image: ghcr.io/ec-cube/ec-cube-php:8.1-apache
  • TAG=8.3-apache 指定時: args.TAGimage のタグが連動して 8.3-apache に切り替わる

マイナーバージョン互換性保持のための制限事項チェックリスト

  • 既存機能の仕様変更はありません
  • フックポイントの呼び出しタイミングの変更はありません
  • フックポイントのパラメータの削除・データ型の変更はありません
  • twigファイルに渡しているパラメータの削除・データ型の変更はありません
  • Serviceクラスの公開関数の、引数の削除・データ型の変更はありません
  • 入出力ファイル(CSVなど)のフォーマット変更はありません

レビュワー確認項目

  • 動作確認
  • コードレビュー
  • E2E/Unit テスト確認(テストの追加・変更が必要かどうか)
  • 互換性が保持されているか
  • セキュリティ上の問題がないか

Summary by CodeRabbit

  • その他(Chores)
    • Docker環境構成を見直し、イメージのタグ切替に対応する設定を明確化しました。
    • ビルド/取得の挙動やキャッシュ・プルに関する設定を整理し、ローカルでの複数バージョン対応手順の注釈を更新しました。

ec-cube2 の EC-CUBE/ec-cube2#1405 と同様に、ec-cube サービスへ build
セクションと pull_policy: missing を追加する。

- build.context / build.args.TAG / build.pull を追加し、image のタグと
  同じ環境変数 TAG を共有させることで、手動の docker build + docker tag
  を不要にする
- pull_policy: missing により、通常の docker compose up は従来どおり
  registry (ghcr.io) からイメージを取得する挙動を維持する
- 手動ビルド用コメントを TAG 環境変数ベースの手順に置き換え
  (例: TAG=8.3-apache docker compose build)

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ddc48e67-2171-4976-acae-f7abfedcf6aa

📥 Commits

Reviewing files that changed from the base of the PR and between fce3244 and b4e5d8a.

📒 Files selected for processing (1)
  • docker-compose.yml

📝 Walkthrough

Walkthrough

docker-compose.yml の ec-cube サービス定義で、TAG 変数による image 指定に切り替え、build ブロック(context, args: TAG, pull: true)と pull_policy: missing を追加し、ローカルビルド手順コメントを TAG 前提の例に更新しました。

変更内容

Docker Compose Configuration

Layer / File(s) 概要
ec-cube サービスのイメージおよびビルド設定
docker-compose.yml
ec-cube サービスの imageTAG 変数で指定するように切替え、build ブロック(contextargs: TAGpull: true)および pull_policy: missing を追加。ローカルビルド手順コメントを TAG 指定前提の例に更新。

推定レビュー工数

🎯 2 (Simple) | ⏱️ ~10 分

Possibly related PRs

  • EC-CUBE/ec-cube#6810: docker-compose.yml の ec-cube サービスで TAG を扱う変更が関連。

推奨レビュアー

  • dotani1111
  • ji-eunsoo

概要

docker-compose.yml の ec-cube サービス定義において、TAG 変数を用いたイメージ指定とビルド設定(context、args、pull、pull_policy)が追加・明確化されました。ローカルビルド手順のコメントも同時に更新されています。

🐰 TAG で跳ねるイメージの舞台
docker-compose に風が通り
ビルド引数は歌を奏でるよ
pull_policy は道を示し
ローカルもリモートも柔らかくつながる

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed プルリクエストのタイトルは、docker-compose.yml で環境変数 TAG により PHP バージョンを切り替え可能にする変更を正確に説明しており、PR の主要な目的と完全に関連しています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docker-compose.yml`:
- Line 30: docker-compose.yml's default TAG value (${TAG:-8.1-apache}) diverges
from the Dockerfile ARG TAG=8.1-apache-bullseye, causing the compose build to
override the Dockerfile default; update the compose defaults so
${TAG:-8.1-apache-bullseye} (and any image: ...:${TAG:-...} usages) match the
Dockerfile ARG TAG value, ensuring consistency between docker-compose.yml's TAG
variable and the Dockerfile's ARG TAG.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2e49f572-f966-49c4-a456-6339f10ff2d2

📥 Commits

Reviewing files that changed from the base of the PR and between 9820448 and fce3244.

📒 Files selected for processing (1)
  • docker-compose.yml

Comment thread docker-compose.yml Outdated
@codecov

codecov Bot commented Jun 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.33%. Comparing base (3f76a03) to head (fce3244).
⚠️ Report is 38 commits behind head on 4.4.

Additional details and impacted files
@@             Coverage Diff              @@
##                4.4    #6813      +/-   ##
============================================
+ Coverage     75.10%   75.33%   +0.23%     
  Complexity     6752     6752              
============================================
  Files           483      483              
  Lines         26279    26277       -2     
============================================
+ Hits          19736    19797      +61     
+ Misses         6543     6480      -63     
Flag Coverage Δ
Unit 75.33% <ø> (+0.23%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dotani1111 dotani1111 merged commit 8ec628c into EC-CUBE:4.4 Jun 10, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants