A simple application that uses ger86's symfony-docker boilerplate as a base. It fetches posts and users from a placeholder json api and merges them with users into a single entity serving it at /api/posts endpoint
It is composed by 3 containers:
nginx, acting as the webserver.php, the PHP-FPM container with the 8.2 version of PHP.dbwhich is the MySQL database container with a MySQL 8.0 image.
- Docker
-
Clone this repo.
-
Create the file
./.docker/.env.nginx.localusing./.docker/.env.nginxas template. The value of the variableNGINX_BACKEND_DOMAINis theserver_nameused in NGINX. -
Go inside folder
./dockerand rundocker compose up -dto start containers. -
Inside the
phpcontainer, runcomposer installto install dependencies from/var/www/symfonyfolder. -
Use the following value for the DATABASE_URL environment variable:
DATABASE_URL=mysql://app_user:helloworld@db:3306/app_db?serverVersion=8.0.33
You could change the name, user and password of the database in the env file at the root of the project.
-
Run migrations
php bin/console doctrine:migrations:migratein the php container -
You can now fetch posts using the
php bin/console app:fetch-postscommand in the container terminal -
You can access the app at
http://localhost/