API Platform projects can be run through Docker. A Docker compose configuration, including a fully working LAMP stack, is shipped with the API Platform distribution.
The Docker Compose configuration comes with several ready-to-use services by default:
Name | Description | Port(s) |
---|---|---|
app | The application with PHP and PHP-FPM 7.1, the latest Composer | N/A |
db | A database provided by MySQL 5.7 | N/A |
nginx | An HTTP server provided by Nginx 1.11 | 8080 |
varnish | An HTTP cache provided by Varnish 4.1 | 80 |
To install it, run the following commands (Docker must be installed on your system):
$ docker-compose up -d # Download, build and run Docker images
$ docker-compose exec app bin/console doctrine:schema:create # Create the MySQL schema
Your project will be accessible in two different ways:
- Through the HTTP cache (Varnish):
http://localhost
- Through the HTTP server directly (Nginx) to facilitate debugging:
http://localhost:8080