Skip to content

Instantly share code, notes, and snippets.

Last active Jun 13, 2021
What would you like to do?
Deploying a Symfony4 Application with Deployer
// see the full blog post on
namespace Deployer;
require 'recipe/symfony4.php';
// if .env variables are needed here, check
// and require __DIR__ . '/vendor/symfony/dotenv/Dotenv.php';
// Project name
set('application', '');
set('allow_anonymous_stats', false);
// Hosts
// Tasks
desc('Build project LOCALLY');
function () {
// build frontend
run('sh bin/build-front');
// build backend
run('composer install --no-ansi --no-dev --no-interaction --no-progress --no-scripts --optimize-autoloader');
desc('Upload project');
task('upload', function () {
upload(__DIR__ . '/*', '{{release_path}}', ['options' =>
desc('Reinstall local vendors');
function () {
run('composer install'); // all devs tools have been previously deleted with --no-dev, let's put them back!
desc('Deploy project');
task('deploy', [ // override the default Symfony4 deploy task
after('deploy', 'local-vendors');
after('deploy', 'success');
// [Optional] if deploy fails automatically unlock.
after('deploy:failed', 'deploy:unlock');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment