fix: deploy from the host, build inside DDEV
dep runs on the host with its SSH keys; the build (composer install, npm ci, npm run build) runs through ddev exec, so Composer and Node are the project's versions. Inside DDEV the commands run directly. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
64aa43c5af
commit
4a9777c56a
1 file changed
+9
-3
+9
-3
@@ -2,7 +2,8 @@
|
||||
|
||||
namespace Deployer;
|
||||
|
||||
// Run inside DDEV after "ddev auth ssh": ddev exec vendor/bin/dep deploy
|
||||
// Run on the host (Deployer 8, PHP >= 8.3): dep deploy prod. The SSH keys stay on the host; the
|
||||
// build runs inside DDEV, so Composer and Node are the project's versions.
|
||||
// Prerequisites on the host: see .ddev/plans/TYPO3-13-GO-LIVE.md (PHP 8.5.12, database, secrets.php)
|
||||
|
||||
require 'recipe/typo3.php';
|
||||
@@ -84,10 +85,15 @@ host('prod')
|
||||
|
||||
desc('Build the release locally: committed state, production dependencies, theme assets');
|
||||
task('build', function () {
|
||||
// Inside DDEV directly, on the host through "ddev exec" (paths relative to the project root)
|
||||
$inDdev = getenv('IS_DDEV_PROJECT') === 'true';
|
||||
$exec = fn (string $command) => runLocally($inDdev
|
||||
? $command
|
||||
: 'ddev exec bash -c ' . escapeshellarg($command));
|
||||
runLocally('rm -rf {{build_dir}} && mkdir -p {{build_dir}}');
|
||||
runLocally('git archive HEAD | tar -x -C {{build_dir}}');
|
||||
runLocally('cd {{build_dir}} && composer install --no-dev --prefer-dist --no-progress --no-interaction --optimize-autoloader');
|
||||
runLocally('cd {{build_dir}} && npm ci --no-audit --no-fund && npm run build');
|
||||
$exec('cd var/deploy-build && composer install --no-dev --prefer-dist --no-progress --no-interaction --optimize-autoloader');
|
||||
$exec('cd var/deploy-build && npm ci --no-audit --no-fund && npm run build');
|
||||
})->once();
|
||||
|
||||
desc('Read-only checks of the host before the first deploy (see .ddev/plans/TYPO3-13-GO-LIVE.md)');
|
||||
|
||||
Reference in new issue
Block a user