1.8 KiB
Installing on an Existing Project
It's also possible to use Symfony Docker with existing projects!
First, download this skeleton.
If you cloned the Git repository, be sure to not copy the .git directory
to prevent conflicts with the .git directory already in your existing project.
You can copy the contents of the repository using Git and tar.
This will not contain .git or any uncommitted changes.
git archive --format=tar HEAD | tar -xC my-existing-project/
If you downloaded the skeleton as a ZIP you can just copy the extracted files:
cp -Rp symfony-docker/. my-existing-project/
Enable the Docker support of Symfony Flex:
composer config --json extra.symfony.docker 'true'
The worker mode of FrankenPHP is enabled by default. To use it with Symfony ≤ 7.3, install the FrankenPHP runtime:
composer require runtime/frankenphp-symfony
Then update worker configuration:
worker {
file ./public/index.php
+ env APP_RUNTIME Runtime\FrankenPhpSymfony\Runtime
{$FRANKENPHP_WORKER_CONFIG}
}
Tip
You can disable worker mode by removing the
workerdirective from thefrankenphpglobal option in yourCaddyfile.
Re-execute the recipes to update the Docker-related files according to the packages you use:
rm symfony.lock
composer recipes:install --force --verbose
Double-check the changes, revert the changes that you don't want to keep:
git diff
Build the Docker images:
docker compose build --pull --no-cache
Start the project!
docker compose up --wait
Browse https://localhost, your Docker configuration is ready!