Skip to content

feat(docker): docker compose で別バージョンタグをビルド可能にする#1405

Open
nanasess wants to merge 1 commit into
EC-CUBE:masterfrom
nanasess:feature/compose-build-section
Open

feat(docker): docker compose で別バージョンタグをビルド可能にする#1405
nanasess wants to merge 1 commit into
EC-CUBE:masterfrom
nanasess:feature/compose-build-section

Conversation

@nanasess
Copy link
Copy Markdown
Contributor

@nanasess nanasess commented Jun 4, 2026

Summary

  • docker-compose.ymlec-cube サービスに build: セクションを追加し、TAG を指定するだけで docker compose build から別 PHP バージョンのイメージをビルドできるようにしました。
  • これまで別バージョンタグをビルドする際は docker compose の枠外で docker build + docker tag を手動実行していましたが、image:build: を併記することで docker compose build の 1 コマンドに集約され、TAG を変更するだけでイメージ名と build arg (TAG) が同期します。
  • pull_policy: missing を明示し、通常の up ではこれまで通りレジストリ (ghcr.io) から pull する従来の挙動を維持しています。ローカルビルドは明示的に build を実行したときのみ行われます。

Changes

  • ec-cube サービスに以下を追加:
    • pull_policy: missing — ローカルに無ければ build ではなく pull する
    • build: セクション(context: .args.TAGpull: true
  • 旧来の docker build / docker tag 手順を案内するコメントを、新しい docker compose build ベースの手順に更新。

新しい運用

# 通常起動 — ローカルに無ければ ghcr.io から pull(build しない)
docker compose up -d --wait

# 別バージョンをローカルビルド(image タグも自動付与 / docker tag 不要)
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       # ビルドして起動

Test plan

検証環境: Docker Compose v5.1.4 / Docker Engine 29.4.3

  • docker compose config — 設定が妥当で pull_policy: missing が反映される
  • TAG=8.3-apache docker compose configimage: タグと build arg TAG の両方に伝播
  • TAG=8.2-apache docker compose up --dry-run — ローカル未取得時に build ではなく pull される(従来挙動を維持)
  • TAG=8.2-apache docker compose build --dry-run — 明示 build 時に Building → ghcr.io/ec-cube/ec-cube2-php:8.2-apache へ自動タグ付け
  • dry-run による network/volume/container の副作用なし

🤖 Generated with Claude Code

Summary by CodeRabbit

リリースノート

  • Chores
    • Docker設定を更新し、ローカル環境でのイメージビルド機能を強化しました。カスタマイズ可能なパラメータにより、構築と起動プロセスがより柔軟になります。

ec-cube サービスに build セクションを追加し、TAG を指定するだけで
docker compose build から別 PHP バージョンのイメージをビルドできるようにした。
image と build を併記することで docker build + docker tag の 2 ステップが
docker compose build に集約され、TAG 変更でイメージ名と build arg が同期する。

pull_policy: missing を明示し、通常の up ではレジストリから pull する
従来の挙動を維持。明示的に build したときのみローカルビルドを行う。

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

coderabbitai Bot commented Jun 4, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

docker-compose.ymlのec-cubeサービス構成にビルド機能を追加しました。pull_policyでイメージポーリング動作を制御し、buildブロックでローカルコンテキストおよびTAGパラメータを指定することで、TAGに応じた動的ビルドが可能になりました。

Changes

Docker Composeビルド設定

Layer / File(s) Summary
ec-cubeサービスのビルド設定追加
docker-compose.yml
ec-cubeサービスにpull_policy: missingbuild.context: .build.args.TAG(デフォルト値8.1-apache)、build.pull: trueを追加。TAGパラメータを環境変数で指定可能にし、ローカルビルド/起動コマンド例のコメントを更新した。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 Composeファイル、新しき息吹
build の設定、かたち整いて
TAG パラメータ、柔軟に舞う
ローカル開発、今はさらに快く
Docker の魔法、深まりけり ✨

🚥 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 での別バージョンタグのビルド可能化という、この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.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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`:
- Around line 17-19: The sample docker-compose commands in docker-compose.yml
lack the required COMPOSE_FILE environment variable to select the DB backend;
update those examples to show setting COMPOSE_FILE to include the base compose
file plus the DB-specific override (e.g.
COMPOSE_FILE=docker-compose.yml:docker-compose.mysql.yml or
COMPOSE_FILE=docker-compose.yml:docker-compose.postgres.yml) and then run the
same commands (build, build --no-cache, up -d --build) after that prefix so
users explicitly choose MySQL 8.4 or PostgreSQL 16 when using the examples.
🪄 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: 301815cf-49b0-4e59-b829-606a331a63cc

📥 Commits

Reviewing files that changed from the base of the PR and between 0f9501c and 183ed2f.

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

Comment thread docker-compose.yml
Comment on lines +17 to +19
## 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 # ビルドして起動
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

運用コマンド例は COMPOSE_FILE 前提を明記してください。

Line 17-19 の例だと DB バックエンド切替の前提が抜けるため、ガイドライン運用とズレます。コメント例に COMPOSE_FILE を含めた方が安全です。

差分案
-    ##   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       # ビルドして起動
+    ##   COMPOSE_FILE=docker-compose.yml:docker-compose.${DB}.yml:docker-compose.dev.yml TAG=8.3-apache docker compose build
+    ##   COMPOSE_FILE=docker-compose.yml:docker-compose.${DB}.yml:docker-compose.dev.yml TAG=8.3-apache docker compose build --no-cache   # キャッシュを使わず再ビルド
+    ##   COMPOSE_FILE=docker-compose.yml:docker-compose.${DB}.yml:docker-compose.dev.yml TAG=8.3-apache docker compose up -d --build       # ビルドして起動

As per coding guidelines, "docker-compose*.yml: Use Docker Compose with environment variables (COMPOSE_FILE) to set up the correct database backend (MySQL 8.4 or PostgreSQL 16)".

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
## 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 # ビルドして起動
## COMPOSE_FILE=docker-compose.yml:docker-compose.${DB}.yml:docker-compose.dev.yml TAG=8.3-apache docker compose build
## COMPOSE_FILE=docker-compose.yml:docker-compose.${DB}.yml:docker-compose.dev.yml TAG=8.3-apache docker compose build --no-cache # キャッシュを使わず再ビルド
## COMPOSE_FILE=docker-compose.yml:docker-compose.${DB}.yml:docker-compose.dev.yml TAG=8.3-apache docker compose up -d --build # ビルドして起動
🤖 Prompt for 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.

In `@docker-compose.yml` around lines 17 - 19, The sample docker-compose commands
in docker-compose.yml lack the required COMPOSE_FILE environment variable to
select the DB backend; update those examples to show setting COMPOSE_FILE to
include the base compose file plus the DB-specific override (e.g.
COMPOSE_FILE=docker-compose.yml:docker-compose.mysql.yml or
COMPOSE_FILE=docker-compose.yml:docker-compose.postgres.yml) and then run the
same commands (build, build --no-cache, up -d --build) after that prefix so
users explicitly choose MySQL 8.4 or PostgreSQL 16 when using the examples.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.20%. Comparing base (0f9501c) to head (183ed2f).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1405   +/-   ##
=======================================
  Coverage   56.20%   56.20%           
=======================================
  Files          87       87           
  Lines       11090    11090           
=======================================
  Hits         6233     6233           
  Misses       4857     4857           
Flag Coverage Δ
tests 56.20% <ø> (ø)

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.

@nanasess nanasess requested review from nobuhiko and seasoftjapan June 4, 2026 21:02
@nanasess nanasess enabled auto-merge June 4, 2026 21:02
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.

1 participant