A template to use Docker with PHP (Laravel, Slim...).
This project uses a sample app names myapp
and a sample user named toto
First, build app:
$ docker-compose build app
Then, run app:
$ docker-compose up -d
Install dependencies:
$ docker-compose exec app rm -rf vendor composer.lock
$ docker-compose exec app composer install
Replace latest
for 2.2
in COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
in Dockerfile
To launch a bash command on Docker:
$ docker-compose exec app php -v
Replace 8.2
for 7.1
in FROM php:8.2-fpm
in Dockerfile
Don't forget to add a .env
file in your project based on .env.example
file of this repository.
Replace image: mysql:8.0
for 5.7
in docker-composer.yml
If using an Apple Mac M1/M2 chip, adds platform: linux/x86_64