fix(suitecrm): generate the Symfony runtime autoloader in the image

public/index.php requires vendor/autoload_runtime.php, which symfony/runtime
writes from its ComposerPlugin on the post-autoload-dump event. Composer's
AutoloadGenerator guards that dispatch behind `if ($this->runScripts)`, and
every composer install in this Dockerfile passes --no-scripts, so the event
never fired and the file was never written. The image shipped, then fataled
on the first request.

A dump-autoload without --no-scripts fires the event. It fires nothing else
here: SuiteCRM 8.9.1 declares no post-autoload-dump script, and its
auto-scripts (cache:clear, cache:warmup, assets:install,
scrm:copy-legacy-assets) plus Google\Task\Composer::cleanup hang off
post-install-cmd, which dump-autoload does not dispatch. The only listener
left is the runtime plugin.

It runs after the --no-dev prune rather than after the first install, so the
autoloader reflects the vendor tree that actually ships and nothing re-dumps
behind it.

The test -f after the seed COPY turns a future regression into a failed
build instead of an image that only breaks at runtime.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5 committed 2026-08-12 02:21:47 +02:00
1 parent 2cf3c5a708
commit e6fb78af49
1 file changed
+4 -1
+4 -1
View File
@@ -100,7 +100,8 @@ RUN set -eux; \
--prefer-dist \
--no-interaction \
--optimize-autoloader \
--no-scripts
--no-scripts; \
composer dump-autoload --no-dev --optimize --no-interaction
RUN set -eux; \
mkdir -p "${SUITECRM_LDAP_EXTENSION_DIR}"; \
@@ -125,6 +126,8 @@ ENV SUITECRM_APP_DIR=${SUITECRM_APP_DIR} \
COPY --from=builder --chown=${SUITECRM_WEB_USER}:${SUITECRM_WEB_GROUP} ${SUITECRM_APP_DIR} ${SUITECRM_SEED_DIR}
RUN test -f "${SUITECRM_SEED_DIR}/vendor/autoload_runtime.php"
RUN set -eux; \
mkdir -p "${SUITECRM_APP_DIR}"; \
chown "${SUITECRM_WEB_USER}:${SUITECRM_WEB_GROUP}" "${SUITECRM_APP_DIR}"