A Docker-based local development environment for PHP/Laravel projects with multiple database options. Inspired by Laradock but simplified for personal use.
- Docker CE (engine)
- Docker Compose (already installed within latest docker)
- nginx
- php-fpm
- postgres
- mysql
- mariadb
- pgadmin
- adminer
- redis-webui
- mailpit
- workspace
- Clone this repo
git clone https://github.com/aldesrahim/localdev
cd localdev- Configure your environment
cp .env.example .env- Start the services
docker compose up -d workspace nginx redis postgres adminer redis-webui mailpitAnd that's it, You're all set!
- Attach into service shell. e.g. workspace
docker compose exec -it workspace bash- Run
php artisancommand
docker compose exec workspace php $project_dir/artisan
# replace $project_dir with your project directory name- Apply
.envchanges. e.g. workspace
docker compose down workspace
docker compose up -d workspace --build --force-recreate- Apply configuration changes. e.g. add nginx sites
docker compose restart nginx- Run
npm run devcommand
# attach into workspace shell
docker compose exec -it workspace bash
# from container
cd $project_dir
# replace $project_dir with your project directory name
npm run dev -- --host
# Open `http://localhost:5173` in browser to test it out.- Laravel storage and cache directories permission denied
# from host machine
chmod 777 -R $project_dir/bootstrap $project_dir/storage
# replace $project_dir with your project path