Skip to content

Conversation

@CybotTM
Copy link
Member

@CybotTM CybotTM commented Jan 18, 2026

Summary

  • Remove GD extension from Docker image (saves ~9MB)
  • PHPSpreadsheet requires GD but only for charts/images - we only use data export
  • Add --ignore-platform-req=ext-gd to all composer install commands

Background

PHPSpreadsheet decided to keep GD required even though it's only needed for:

  • MemoryDrawing.php - embedding images
  • Chart rendering

Since TimeTracker only uses XLSX export for data (no charts or images), we can safely ignore the platform requirement.

Changes

  • Dockerfile: Removed GD and its dependencies (libpng-dev, libjpeg62-turbo-dev, libfreetype6-dev)
  • Dockerfile: Added comments explaining the GD omission
  • CI workflow: Added --ignore-platform-req=ext-gd to composer commands
  • Makefile: Added --ignore-platform-req=ext-gd to composer-install target

Image Size Impact

  • Before: 976MB
  • After: 967MB
  • Saved: ~9MB

Related to #210

PHPSpreadsheet requires ext-gd, but we only use it for data export
(Xlsx Writer) without charts or images. GD is only needed for:
- Chart rendering
- Image manipulation in spreadsheets
- Drawing objects

Since we don't use these features, we can safely omit GD and use
--ignore-platform-req=ext-gd in composer commands.

PHPSpreadsheet maintainers decided to keep GD required (PR #3766),
but recommend this workaround for advanced users who know their
use case doesn't need GD.

Benefits:
- Reduces image size by ~9MB
- Removes libpng, libjpeg, freetype dependencies
- Smaller attack surface

Refs: PHPOffice/PhpSpreadsheet#3766
Copilot AI review requested due to automatic review settings January 18, 2026 19:03
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes the GD PHP extension from the Docker image to reduce image size by approximately 9MB. Since TimeTracker only uses PHPSpreadsheet for data export (not charts or images), the GD extension is not required at runtime. The --ignore-platform-req=ext-gd flag is added to composer commands to bypass PHPSpreadsheet's platform check.

Changes:

  • Removed GD extension and related system dependencies from Dockerfile
  • Added --ignore-platform-req=ext-gd flag to composer install commands in Dockerfile, CI workflow, and Makefile
  • Added explanatory comments documenting why GD is omitted

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
Dockerfile Removed GD extension, libpng-dev, libjpeg62-turbo-dev, and libfreetype6-dev dependencies; added comments explaining the omission; updated all three composer install commands with platform requirement flags
Makefile Updated composer-install target with new platform requirement flags and improved comments
.github/workflows/ci.yml Updated composer install commands in both lint and test jobs with platform requirement flags and consistent comments

docker compose run --rm app-dev composer install --ignore-platform-req=php --ignore-platform-req=ext-gd

composer-update:
docker compose run --rm app-dev composer update
Copy link

Copilot AI Jan 18, 2026

Choose a reason for hiding this comment

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

The composer-update target should also include the --ignore-platform-req flags for consistency. When developers run "make composer-update", composer will check platform requirements and fail due to the missing ext-gd extension. Add the same flags used in composer-install: --ignore-platform-req=php --ignore-platform-req=ext-gd

Suggested change
docker compose run --rm app-dev composer update
docker compose run --rm app-dev composer update --ignore-platform-req=php --ignore-platform-req=ext-gd

Copilot uses AI. Check for mistakes.
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.

2 participants