mirror of
https://github.com/symfony/recipes-contrib.git
synced 2026-09-14 08:36:34 +03:00
56 lines
1.3 KiB
PHP
Executable File
56 lines
1.3 KiB
PHP
Executable File
#!/usr/bin/env php
|
|
<?php
|
|
|
|
require __DIR__ . '/../vendor/autoload.php';
|
|
|
|
use Symfony\Component\Filesystem\Filesystem;
|
|
|
|
const SOURCE_DIRECTORY = 'vendor/ajardin/docker-symfony';
|
|
const TARGET_DIRECTORY = 'docker';
|
|
|
|
$filesystem = new Filesystem();
|
|
|
|
/**
|
|
* Create the Docker directory at the project root
|
|
*/
|
|
if ($filesystem->exists(TARGET_DIRECTORY) === false) {
|
|
$filesystem->mkdir(TARGET_DIRECTORY);
|
|
}
|
|
|
|
/**
|
|
* Mirror the vendor directory with the directory created at the project root
|
|
*/
|
|
if ($filesystem->exists(SOURCE_DIRECTORY) === true) {
|
|
$filesystem->mirror(SOURCE_DIRECTORY, TARGET_DIRECTORY, null, ['override' => true]);
|
|
}
|
|
|
|
/**
|
|
* Define the default environment variables
|
|
*/
|
|
if ($filesystem->exists(TARGET_DIRECTORY . '/.env') === false) {
|
|
$filesystem->copy(
|
|
TARGET_DIRECTORY . '/.env.dist',
|
|
TARGET_DIRECTORY . '/.env'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Define the default Nginx configuration
|
|
*/
|
|
if ($filesystem->exists(TARGET_DIRECTORY . '/nginx/conf.d/custom.conf') === false) {
|
|
$filesystem->copy(
|
|
TARGET_DIRECTORY . '/nginx/conf.d/symfony.conf.dist',
|
|
TARGET_DIRECTORY . '/nginx/conf.d/custom.conf'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Copy the default Makefile at the project root
|
|
*/
|
|
if ($filesystem->exists('Makefile') === false) {
|
|
$filesystem->copy(
|
|
TARGET_DIRECTORY . '/Makefile.sample',
|
|
'Makefile'
|
|
);
|
|
}
|