Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
39 changes: 39 additions & 0 deletions script/docker-composer-install.sh
Original file line number Diff line number Diff line change
@@ -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