From 5d961ec003a4e403ef3ba078e2f42c78b04113a9 Mon Sep 17 00:00:00 2001 From: PurHur Date: Tue, 26 May 2026 21:12:55 +0000 Subject: [PATCH] Add docker composer install helper for harness Adds script/docker-composer-install.sh and a Makefile target to materialize vendor/ onto the host workspace via the dev Docker image when bind-mounts are empty. Co-authored-by: Cursor --- Makefile | 5 ++++ script/docker-composer-install.sh | 39 +++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100755 script/docker-composer-install.sh diff --git a/Makefile b/Makefile index 84389015f76..ea4fe242b25 100755 --- a/Makefile +++ b/Makefile @@ -77,6 +77,11 @@ phan: test: docker-build-22 ./script/docker-ci-local.sh +# Harness/dev convenience: install vendor/ without host PHP/composer. +.PHONY: vendor-docker +vendor-docker: docker-build-22 + ./script/docker-composer-install.sh + # Deprecated: PHP 7.4 on Ubuntu 16.04 (ircmaxell/php-compiler:16.04-dev image often unavailable). .PHONY: test-legacy-16 test-legacy-16: rebuild-changed diff --git a/script/docker-composer-install.sh b/script/docker-composer-install.sh new file mode 100755 index 00000000000..4ea20b0dd73 --- /dev/null +++ b/script/docker-composer-install.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +# Install vendor/ using the dev Docker image, safe on harness hosts where bind-mounts are empty. +# +# This script writes vendor/ into the host workspace by streaming it back as a tarball, so that +# subsequent docker-exec / bootstrap gates can use the normal bind-mount fast path. +# +# Usage: +# ./script/docker-composer-install.sh +set -euo pipefail +cd "$(dirname "$0")/.." + +IMAGE="${PHP_COMPILER_DEV_IMAGE:-php-compiler:22.04-dev}" + +# shellcheck source=ci-docker-preflight.sh +source "$(dirname "$0")/ci-docker-preflight.sh" +ci_docker_preflight +ci_docker_acquire_single_ci_lock + +# shellcheck source=ci-docker-run.sh +source "$(dirname "$0")/ci-docker-run.sh" + +if ! docker image inspect "$IMAGE" >/dev/null 2>&1; then + echo "Building dev image $IMAGE (make docker-build-22)..." + make docker-build-22 +fi + +rm -rf vendor +mkdir -p vendor + +# Stream vendor/ back to host so it persists between runs. +tar -cf - --exclude='.git' --exclude='.llvm' . | ci_docker_run -i -w /compiler "$IMAGE" bash -lc " + set -euo pipefail + tar -xf - + composer install --ignore-platform-reqs --no-ansi --no-interaction --no-progress + ./script/apply-patches.sh >/dev/null || true + tar -cf - vendor +" | tar -xf - + +test -f vendor/autoload.php