Skip to content

refactor: trim unused PHP extensions and build deps from the local Docker image / ローカルDockerイメージの不要な拡張とビルド依存を削除 - #606

Merged
zigzagdev merged 1 commit into
mainfrom
refactor/trim-docker-image
Oct 25, 2026
Merged

zigzagdev merged 1 commit into
mainfrom
refactor/trim-docker-image

Conversation

@zigzagdev

Copy link
Copy Markdown
Owner

Motivation / 目的

environment/local/docker/Dockerfile installed several PHP extensions
(bcmath, exif, gd, zip, intl) and their apt -dev build headers that
nothing in this codebase actually uses, inflating the local dev image for no
benefit.

environment/local/docker/Dockerfileはbcmath/exif/gd/zip/intlといった拡張と、
それらのビルド用apt -devヘッダーをインストールしていましたが、このコードベースのどこからも
使われていませんでした。メリットなくローカル開発用イメージを肥大化させていました。

What I have done / 実施内容

  • Confirmed composer.json only requires ext-dom / ext-xml
  • Confirmed via grep that app/ has zero usage of gd/exif/zip/bcmath/native intl
    functions (the app's symfony/intl dependency is a pure-PHP package and does not need the
    native ICU extension)
  • Confirmed via php -m on the running container that dom/xml/xmlreader/xmlwriter are
    already bundled by php:8.2-fpm-bookworm without this Dockerfile installing them
  • Removed bcmath, exif, gd (and its --with-freetype --with-jpeg configure step), zip,
    intl from docker-php-ext-install
  • Removed the now-unused apt -dev packages: libpng-dev, libjpeg62-turbo-dev,
    libfreetype6-dev, libzip-dev, libicu-dev, libxml2-dev
  • Kept pdo_mysql/mbstring (+ libonig-dev) and the infra/dev-convenience packages
    (nginx, ca-certificates, curl, tzdata, gettext-base, git, unzip)

Test Results / テスト結果

  • Rebuilt the image from a clean cache (docker compose build --no-cache app): succeeds
  • php -m in the rebuilt container confirms the trimmed extensions are gone and
    dom/xml/mbstring/pdo_mysql are present
  • Smoke-tested the running stack end-to-end: GET /api/v1/heritages?page=1 returns 200
    through nginx + php-fpm + MySQL
  • php artisan test (full suite): 217 passed, no regressions

Closes #605

@zigzagdev
zigzagdev merged commit 3f9ad4e into main Oct 25, 2026
1 check passed

@zigzagdev zigzagdev left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Ok

@zigzagdev zigzagdev self-assigned this Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trim unused PHP extensions and build deps from the local Docker image

1 participant