diff --git a/.docker/cli.dockerfile b/.docker/cli.dockerfile index 7fb1909d6..0254e16e6 100644 --- a/.docker/cli.dockerfile +++ b/.docker/cli.dockerfile @@ -74,7 +74,7 @@ COPY scripts /app/scripts # to the repository. # The .env file (and other environment files) is copied into the image, as it # may be needed by Composer scripts to access additional variables. -COPY composer.json composer.* patches.lock.* .env* auth* /app/ +COPY composer.json composer.* patches.lock.* .env* /app/ #;< VORTEX_DEV # Copy the in-tree drevops/vortex-tooling package so the path repository diff --git a/.dockerignore b/.dockerignore index 22544fa0e..b690ae92a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -11,6 +11,9 @@ .vscode **/.DS_Store +# Credentials. The package token reaches the build through a build secret. +auth* + # Drupal directories generated by Composer during the image build. web/core web/libraries diff --git a/.vortex/installer/tests/Fixtures/handler_process/_baseline/.docker/cli.dockerfile b/.vortex/installer/tests/Fixtures/handler_process/_baseline/.docker/cli.dockerfile index b176e93b4..f431a3d40 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/_baseline/.docker/cli.dockerfile +++ b/.vortex/installer/tests/Fixtures/handler_process/_baseline/.docker/cli.dockerfile @@ -74,7 +74,7 @@ COPY scripts /app/scripts # to the repository. # The .env file (and other environment files) is copied into the image, as it # may be needed by Composer scripts to access additional variables. -COPY composer.json composer.* patches.lock.* .env* auth* /app/ +COPY composer.json composer.* patches.lock.* .env* /app/ # Install PHP dependencies without development packages to avoid exposing # potential security vulnerabilities in the production environment. diff --git a/.vortex/installer/tests/Fixtures/handler_process/_baseline/.dockerignore b/.vortex/installer/tests/Fixtures/handler_process/_baseline/.dockerignore index 969dc2a0c..3d49b3b10 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/_baseline/.dockerignore +++ b/.vortex/installer/tests/Fixtures/handler_process/_baseline/.dockerignore @@ -11,6 +11,9 @@ .vscode **/.DS_Store +# Credentials. The package token reaches the build through a build secret. +auth* + # Drupal directories generated by Composer during the image build. web/core web/libraries diff --git a/.vortex/installer/tests/Fixtures/handler_process/ciprovider_circleci/.dockerignore b/.vortex/installer/tests/Fixtures/handler_process/ciprovider_circleci/.dockerignore index e0fa230b8..56497d2e8 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/ciprovider_circleci/.dockerignore +++ b/.vortex/installer/tests/Fixtures/handler_process/ciprovider_circleci/.dockerignore @@ -1,4 +1,4 @@ -@@ -42,9 +42,6 @@ +@@ -45,9 +45,6 @@ **/.phpunit.cache **/.twig-cs-fixer.cache diff --git a/.vortex/installer/tests/Fixtures/handler_process/code_coverage_provider_codecov_circleci/.dockerignore b/.vortex/installer/tests/Fixtures/handler_process/code_coverage_provider_codecov_circleci/.dockerignore index e0fa230b8..56497d2e8 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/code_coverage_provider_codecov_circleci/.dockerignore +++ b/.vortex/installer/tests/Fixtures/handler_process/code_coverage_provider_codecov_circleci/.dockerignore @@ -1,4 +1,4 @@ -@@ -42,9 +42,6 @@ +@@ -45,9 +45,6 @@ **/.phpunit.cache **/.twig-cs-fixer.cache diff --git a/.vortex/installer/tests/Fixtures/handler_process/deploy_types_all_circleci/.dockerignore b/.vortex/installer/tests/Fixtures/handler_process/deploy_types_all_circleci/.dockerignore index e0fa230b8..56497d2e8 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/deploy_types_all_circleci/.dockerignore +++ b/.vortex/installer/tests/Fixtures/handler_process/deploy_types_all_circleci/.dockerignore @@ -1,4 +1,4 @@ -@@ -42,9 +42,6 @@ +@@ -45,9 +45,6 @@ **/.phpunit.cache **/.twig-cs-fixer.cache diff --git a/.vortex/installer/tests/Fixtures/handler_process/deploy_types_none_circleci/.dockerignore b/.vortex/installer/tests/Fixtures/handler_process/deploy_types_none_circleci/.dockerignore index e0fa230b8..56497d2e8 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/deploy_types_none_circleci/.dockerignore +++ b/.vortex/installer/tests/Fixtures/handler_process/deploy_types_none_circleci/.dockerignore @@ -1,4 +1,4 @@ -@@ -42,9 +42,6 @@ +@@ -45,9 +45,6 @@ **/.phpunit.cache **/.twig-cs-fixer.cache diff --git a/.vortex/installer/tests/Fixtures/handler_process/deps_updates_provider_ci_circleci/.dockerignore b/.vortex/installer/tests/Fixtures/handler_process/deps_updates_provider_ci_circleci/.dockerignore index e0fa230b8..56497d2e8 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/deps_updates_provider_ci_circleci/.dockerignore +++ b/.vortex/installer/tests/Fixtures/handler_process/deps_updates_provider_ci_circleci/.dockerignore @@ -1,4 +1,4 @@ -@@ -42,9 +42,6 @@ +@@ -45,9 +45,6 @@ **/.phpunit.cache **/.twig-cs-fixer.cache diff --git a/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/.dockerignore b/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/.dockerignore index 5d1e4895e..1c380b297 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/.dockerignore +++ b/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/.dockerignore @@ -1,5 +1,5 @@ -@@ -12,28 +12,28 @@ - **/.DS_Store +@@ -15,28 +15,28 @@ + auth* # Drupal directories generated by Composer during the image build. -web/core diff --git a/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/.dockerignore b/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/.dockerignore index 5d1e4895e..1c380b297 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/.dockerignore +++ b/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/.dockerignore @@ -1,5 +1,5 @@ -@@ -12,28 +12,28 @@ - **/.DS_Store +@@ -15,28 +15,28 @@ + auth* # Drupal directories generated by Composer during the image build. -web/core diff --git a/.vortex/installer/tests/Fixtures/handler_process/migration_disabled_circleci/.dockerignore b/.vortex/installer/tests/Fixtures/handler_process/migration_disabled_circleci/.dockerignore index e0fa230b8..56497d2e8 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/migration_disabled_circleci/.dockerignore +++ b/.vortex/installer/tests/Fixtures/handler_process/migration_disabled_circleci/.dockerignore @@ -1,4 +1,4 @@ -@@ -42,9 +42,6 @@ +@@ -45,9 +45,6 @@ **/.phpunit.cache **/.twig-cs-fixer.cache diff --git a/.vortex/installer/tests/Fixtures/handler_process/migration_enabled_circleci/.dockerignore b/.vortex/installer/tests/Fixtures/handler_process/migration_enabled_circleci/.dockerignore index e0fa230b8..56497d2e8 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/migration_enabled_circleci/.dockerignore +++ b/.vortex/installer/tests/Fixtures/handler_process/migration_enabled_circleci/.dockerignore @@ -1,4 +1,4 @@ -@@ -42,9 +42,6 @@ +@@ -45,9 +45,6 @@ **/.phpunit.cache **/.twig-cs-fixer.cache diff --git a/.vortex/installer/tests/Fixtures/handler_process/timezone_circleci/.dockerignore b/.vortex/installer/tests/Fixtures/handler_process/timezone_circleci/.dockerignore index e0fa230b8..56497d2e8 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/timezone_circleci/.dockerignore +++ b/.vortex/installer/tests/Fixtures/handler_process/timezone_circleci/.dockerignore @@ -1,4 +1,4 @@ -@@ -42,9 +42,6 @@ +@@ -45,9 +45,6 @@ **/.phpunit.cache **/.twig-cs-fixer.cache diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_lint_circleci/.dockerignore b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_lint_circleci/.dockerignore index e0fa230b8..56497d2e8 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_lint_circleci/.dockerignore +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_lint_circleci/.dockerignore @@ -1,4 +1,4 @@ -@@ -42,9 +42,6 @@ +@@ -45,9 +45,6 @@ **/.phpunit.cache **/.twig-cs-fixer.cache diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_tests/.dockerignore b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_tests/.dockerignore index 978d82317..65d1dcd4f 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_tests/.dockerignore +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_tests/.dockerignore @@ -1,4 +1,4 @@ -@@ -39,7 +39,6 @@ +@@ -42,7 +42,6 @@ **/.artifacts **/.data **/.logs diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_tests_circleci/.dockerignore b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_tests_circleci/.dockerignore index 24012fd26..863172d3c 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_tests_circleci/.dockerignore +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_tests_circleci/.dockerignore @@ -1,4 +1,4 @@ -@@ -39,11 +39,7 @@ +@@ -42,11 +42,7 @@ **/.artifacts **/.data **/.logs diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_circleci/.dockerignore b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_circleci/.dockerignore index e0fa230b8..56497d2e8 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_circleci/.dockerignore +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_circleci/.dockerignore @@ -1,4 +1,4 @@ -@@ -42,9 +42,6 @@ +@@ -45,9 +45,6 @@ **/.phpunit.cache **/.twig-cs-fixer.cache diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_no_theme_circleci/.dockerignore b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_no_theme_circleci/.dockerignore index e0fa230b8..56497d2e8 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_no_theme_circleci/.dockerignore +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_no_theme_circleci/.dockerignore @@ -1,4 +1,4 @@ -@@ -42,9 +42,6 @@ +@@ -45,9 +45,6 @@ **/.phpunit.cache **/.twig-cs-fixer.cache diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_behat_circleci/.dockerignore b/.vortex/installer/tests/Fixtures/handler_process/tools_no_behat_circleci/.dockerignore index e0fa230b8..56497d2e8 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_behat_circleci/.dockerignore +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_behat_circleci/.dockerignore @@ -1,4 +1,4 @@ -@@ -42,9 +42,6 @@ +@@ -45,9 +45,6 @@ **/.phpunit.cache **/.twig-cs-fixer.cache diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_dclint_circleci/.dockerignore b/.vortex/installer/tests/Fixtures/handler_process/tools_no_dclint_circleci/.dockerignore index e0fa230b8..56497d2e8 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_dclint_circleci/.dockerignore +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_dclint_circleci/.dockerignore @@ -1,4 +1,4 @@ -@@ -42,9 +42,6 @@ +@@ -45,9 +45,6 @@ **/.phpunit.cache **/.twig-cs-fixer.cache diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_docker_linters_circleci/.dockerignore b/.vortex/installer/tests/Fixtures/handler_process/tools_no_docker_linters_circleci/.dockerignore index e0fa230b8..56497d2e8 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_docker_linters_circleci/.dockerignore +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_docker_linters_circleci/.dockerignore @@ -1,4 +1,4 @@ -@@ -42,9 +42,6 @@ +@@ -45,9 +45,6 @@ **/.phpunit.cache **/.twig-cs-fixer.cache diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_eslint_circleci/.dockerignore b/.vortex/installer/tests/Fixtures/handler_process/tools_no_eslint_circleci/.dockerignore index e0fa230b8..56497d2e8 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_eslint_circleci/.dockerignore +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_eslint_circleci/.dockerignore @@ -1,4 +1,4 @@ -@@ -42,9 +42,6 @@ +@@ -45,9 +45,6 @@ **/.phpunit.cache **/.twig-cs-fixer.cache diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_hadolint_circleci/.dockerignore b/.vortex/installer/tests/Fixtures/handler_process/tools_no_hadolint_circleci/.dockerignore index e0fa230b8..56497d2e8 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_hadolint_circleci/.dockerignore +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_hadolint_circleci/.dockerignore @@ -1,4 +1,4 @@ -@@ -42,9 +42,6 @@ +@@ -45,9 +45,6 @@ **/.phpunit.cache **/.twig-cs-fixer.cache diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_jest_circleci/.dockerignore b/.vortex/installer/tests/Fixtures/handler_process/tools_no_jest_circleci/.dockerignore index e0fa230b8..56497d2e8 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_jest_circleci/.dockerignore +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_jest_circleci/.dockerignore @@ -1,4 +1,4 @@ -@@ -42,9 +42,6 @@ +@@ -45,9 +45,6 @@ **/.phpunit.cache **/.twig-cs-fixer.cache diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpcs_circleci/.dockerignore b/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpcs_circleci/.dockerignore index e0fa230b8..56497d2e8 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpcs_circleci/.dockerignore +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpcs_circleci/.dockerignore @@ -1,4 +1,4 @@ -@@ -42,9 +42,6 @@ +@@ -45,9 +45,6 @@ **/.phpunit.cache **/.twig-cs-fixer.cache diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpstan_circleci/.dockerignore b/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpstan_circleci/.dockerignore index e0fa230b8..56497d2e8 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpstan_circleci/.dockerignore +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpstan_circleci/.dockerignore @@ -1,4 +1,4 @@ -@@ -42,9 +42,6 @@ +@@ -45,9 +45,6 @@ **/.phpunit.cache **/.twig-cs-fixer.cache diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpunit/.dockerignore b/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpunit/.dockerignore index 978d82317..65d1dcd4f 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpunit/.dockerignore +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpunit/.dockerignore @@ -1,4 +1,4 @@ -@@ -39,7 +39,6 @@ +@@ -42,7 +42,6 @@ **/.artifacts **/.data **/.logs diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpunit_circleci/.dockerignore b/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpunit_circleci/.dockerignore index 24012fd26..863172d3c 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpunit_circleci/.dockerignore +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpunit_circleci/.dockerignore @@ -1,4 +1,4 @@ -@@ -39,11 +39,7 @@ +@@ -42,11 +42,7 @@ **/.artifacts **/.data **/.logs diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_rector_circleci/.dockerignore b/.vortex/installer/tests/Fixtures/handler_process/tools_no_rector_circleci/.dockerignore index e0fa230b8..56497d2e8 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_rector_circleci/.dockerignore +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_rector_circleci/.dockerignore @@ -1,4 +1,4 @@ -@@ -42,9 +42,6 @@ +@@ -45,9 +45,6 @@ **/.phpunit.cache **/.twig-cs-fixer.cache diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_stylelint_circleci/.dockerignore b/.vortex/installer/tests/Fixtures/handler_process/tools_no_stylelint_circleci/.dockerignore index e0fa230b8..56497d2e8 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_stylelint_circleci/.dockerignore +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_stylelint_circleci/.dockerignore @@ -1,4 +1,4 @@ -@@ -42,9 +42,6 @@ +@@ -45,9 +45,6 @@ **/.phpunit.cache **/.twig-cs-fixer.cache diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_twig/.dockerignore b/.vortex/installer/tests/Fixtures/handler_process/tools_no_twig/.dockerignore index ccae92dfb..19b4091ee 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_twig/.dockerignore +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_twig/.dockerignore @@ -1,4 +1,4 @@ -@@ -40,7 +40,6 @@ +@@ -43,7 +43,6 @@ **/.data **/.logs **/.phpunit.cache diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_twig_circleci/.dockerignore b/.vortex/installer/tests/Fixtures/handler_process/tools_no_twig_circleci/.dockerignore index 91caaf540..cec6b01cb 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_twig_circleci/.dockerignore +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_twig_circleci/.dockerignore @@ -1,4 +1,4 @@ -@@ -40,10 +40,6 @@ +@@ -43,10 +43,6 @@ **/.data **/.logs **/.phpunit.cache diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_none/.dockerignore b/.vortex/installer/tests/Fixtures/handler_process/tools_none/.dockerignore index aa8e7069e..41dc02d87 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_none/.dockerignore +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_none/.dockerignore @@ -1,4 +1,4 @@ -@@ -39,8 +39,6 @@ +@@ -42,8 +42,6 @@ **/.artifacts **/.data **/.logs diff --git a/.vortex/tests/phpunit/Functional/DockerComposeWorkflowTest.php b/.vortex/tests/phpunit/Functional/DockerComposeWorkflowTest.php index dad613ba8..48c171a03 100644 --- a/.vortex/tests/phpunit/Functional/DockerComposeWorkflowTest.php +++ b/.vortex/tests/phpunit/Functional/DockerComposeWorkflowTest.php @@ -128,11 +128,20 @@ public function testDockerComposePackageToken(): void { $this->assertFileContainsString('composer.json', 'drevops/test-private-package', 'composer.json should contain private package'); File::remove('composer.lock'); + $this->logSubstep('Adding a decoy auth.json to the build context'); + // The bogus token leaves both build outcomes unchanged, so the assertion + // below tests only whether the file reaches the image. + File::dump('auth.json', json_encode(['github-oauth' => ['github.com' => 'decoy-token']], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n"); + $this->logSubstep('Building without PACKAGE_TOKEN - should fail'); $this->cmdFail('docker compose build cli --no-cache', '* did not complete successfully', txt: 'Build stack images without token should fail', env: ['PACKAGE_TOKEN' => FALSE], tio: 900); $this->logSubstep('Building with PACKAGE_TOKEN - should succeed'); $this->cmd('docker compose build cli --no-cache', txt: 'Build stack images with token should succeed', env: ['PACKAGE_TOKEN' => $package_token], tio: 900); + + $this->logSubstep('Asserting that auth.json is absent from the built image'); + $this->assertFileExists('auth.json', 'auth.json should still exist in the build context'); + $this->cmd('docker compose run --rm --no-deps -T --entrypoint bash cli -c "test ! -f /app/auth.json"', txt: 'Built image should not contain auth.json'); } } diff --git a/.vortex/tests/phpunit/Traits/SutTrait.php b/.vortex/tests/phpunit/Traits/SutTrait.php index 64602dcb0..963dc9d64 100644 --- a/.vortex/tests/phpunit/Traits/SutTrait.php +++ b/.vortex/tests/phpunit/Traits/SutTrait.php @@ -128,7 +128,7 @@ protected function injectTestingTooling(): void { $dockerfile_path = $sut_root . DIRECTORY_SEPARATOR . '.docker' . DIRECTORY_SEPARATOR . 'cli.dockerfile'; if (file_exists($dockerfile_path)) { $content = (string) file_get_contents($dockerfile_path); - $needle = 'COPY composer.json composer.* patches.lock.* .env* auth* /app/'; + $needle = 'COPY composer.json composer.* patches.lock.* .env* /app/'; $replacement = $needle . "\n\n# Test-only: enables path-repo resolution.\nCOPY .tooling-source /app/.tooling-source"; file_put_contents($dockerfile_path, str_replace($needle, $replacement, $content)); }