Skip to content

aldesrahim/localdev

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

localdev

A Docker-based local development environment for PHP/Laravel projects with multiple database options. Inspired by Laradock but simplified for personal use.

Pre-requisite

  • Docker CE (engine)
  • Docker Compose (already installed within latest docker)

Available services

  • nginx
  • php-fpm
  • postgres
  • mysql
  • mariadb
  • pgadmin
  • adminer
  • redis-webui
  • mailpit
  • workspace

Usage

  1. Clone this repo
git clone https://github.com/aldesrahim/localdev
cd localdev
  1. Configure your environment
cp .env.example .env
  1. Start the services
docker compose up -d workspace nginx redis postgres adminer redis-webui mailpit

And that's it, You're all set!

Tips

  1. Attach into service shell. e.g. workspace
docker compose exec -it workspace bash
  1. Run php artisan command
docker compose exec workspace php $project_dir/artisan
# replace $project_dir with your project directory name
  1. Apply .env changes. e.g. workspace
docker compose down workspace
docker compose up -d workspace --build --force-recreate
  1. Apply configuration changes. e.g. add nginx sites
docker compose restart nginx
  1. Run npm run dev command
# 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.

Troubleshoot

  1. 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

About

Docker-based local development setup

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published