Build laravel development environment with docker

ucan_lab

ucan_lab

Posted on May 9, 2020

Build laravel development environment with docker

I created a nice development environment for Laravel šŸ‘

Repository

https://github.com/ucan-lab/docker-laravel

Please try it ā­ļø

Installing Docker

https://docs.docker.com/docker-for-mac/install/

Project Structure

.
ā”œā”€ā”€ src # Laravel project root directory
ā””ā”€ā”€ infra
     ā”œā”€ā”€ docker
     ā”‚   ā”œā”€ā”€ mysql
     ā”‚   ā”‚   ā”œā”€ā”€ Dockerfile
     ā”‚   ā”‚   ā””ā”€ā”€ my.cnf
     ā”‚   ā”œā”€ā”€ nginx
     ā”‚   ā”‚   ā”œā”€ā”€ Dockerfile
     ā”‚   ā”‚   ā”œā”€ā”€ Dockerfile.production
     ā”‚   ā”‚   ā””ā”€ā”€ default.conf
     ā”‚   ā””ā”€ā”€ php
     ā”‚       ā”œā”€ā”€ Dockerfile
     ā”‚       ā”œā”€ā”€ Dockerfile.production
     ā”‚       ā”œā”€ā”€ bash
     ā”‚       ā”‚   ā”œā”€ā”€ .bash_history
     ā”‚       ā”‚   ā””ā”€ā”€ psysh
     ā”‚       ā”œā”€ā”€ php-fpm.d
     ā”‚       ā”‚   ā””ā”€ā”€ zzz-www.conf => unix domain socket config file
     ā”‚       ā”œā”€ā”€ php.ini
     ā”‚       ā””ā”€ā”€ php.production.ini
     ā””ā”€ā”€ docker-compose.yml
Enter fullscreen mode Exit fullscreen mode

How to use

Read the Makefile for the contents

A. Create a new laravel project

$ git clone git@github.com:ucan-lab/docker-laravel.git
$ cd docker-laravel
$ mkdir -p src
$ docker compose build
$ docker compose up -d
$ docker compose exec app composer create-project --prefer-dist laravel/laravel .
$ docker compose exec app php artisan key:generate
$ docker compose exec app php artisan storage:link
$ docker compose exec app chmod -R 777 storage bootstrap/cache
$ docker compose exec app php artisan migrate
Enter fullscreen mode Exit fullscreen mode

http://localhost

B. Create a clone laravel project

$ git clone git@github.com:ucan-lab/docker-laravel.git
$ cd docker-laravel
$ mkdir -p src
$ docker compose build
$ docker compose up -d

$ docker compose exec app composer create-project --prefer-dist "laravel/laravel=6.*" .

$ docker compose exec app php artisan key:generate
$ docker compose exec app php artisan storage:link
$ docker compose exec app chmod -R 777 storage bootstrap/cache
$ docker compose exec app php artisan migrate
Enter fullscreen mode Exit fullscreen mode

http://localhost

šŸ’– šŸ’Ŗ šŸ™… šŸš©
ucan_lab
ucan_lab

Posted on May 9, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related