Skip to content

mnr73/laravel-docker-compose

Repository files navigation

Laravel LogoLaravel Logo

About this Laravel fresh repo

this laravel repo provide simple docker files and docker compose to run Laravel for develop and production purpose. this repo is contain three docker compose files.

  • docker-compose-common.yml : the base of docker compose files
  • docker-compose-prd.yml : docker compose file for production
  • docker-compose.yml : docker compose file for development in local

to work with this docker compose files you need docker base knowledge.

docker files placed in /mnr_docker directory.

in additional add Laravel ide helper package and put some setting for auto generate files. for auto generate files you need this run on save extension for vsCode.

How to use

  • step 1: clone repo
  • step 2 (optional): you can remove /.git directory and initial repo again
  • step 3: cp .env.example to .env
  • step 4: the default database in .env file is sqlite if you want continue to use taht you can comment or remove mysql and phpMyAdmin services in docker compose files. or change DB_CONNECTION value to mysql in .env file. change env file like below lines to use mysql. if you want user other databases you should change docker compose files.
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=laravel
DB_PASSWORD=password
  • step 5: change other env variable if you need and run docker compose up -d
  • step 6: run docker compose exec -it -u 1000 laravel composer install
  • step 7: run docker compose exec -it -u 1000 laravel php artisan key:generate
  • step 8: run docker compose exec -it -u 1000 laravel php artisan migrate
  • step 9: open localhost to see laravel welcome page

About

run latest Laravel version with docker compose

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages