-
Create network for environment:
docker network create laravel-environment -
Build image in the current directory (where Dockerfile is):
Don't forget to set UID/GID in Dockerfile to local user!
docker build -t laravel-environment . -
Creating containers for developing laravel application:
-v set mounts local directory to docker container
cd LARAVEL_APP_DIR
docker run --net laravel-environment -v $(pwd):/var/www --name container-name laravel-environment
docker run --name redis --net laravel-environment redis -
Install mysql
docker run --net laravel-environment -v laravel-environment:/var/lib/mysql --name mysql -e MYSQL_ROOT_PASSWORD=secret_password -d mysql:5.7
docker container cp scheme.sql mysql:/root/scheme.sql
docker container exec -it mysql mysql -u root -p -e 'CREATE DATABASE db_name'
docker container exec -it mysql bash
mysql -u root -p db_name < /root/scheme.sql
exit -
Install .env & composer dependencies:
docker container exec -ti container-name bash
cd /var/www
composer update
cp .env.example .env
php artisan key:generate -
In .env file of laravel set:
REDIS_HOST=redis
REDIS_PASSWORD=null
REDIS_PORT=6379
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=db_name
DB_USERNAME=root
DB_PASSWORD=secret_password
-
Notifications
You must be signed in to change notification settings - Fork 0
gunzino/laravel-docker
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Simple docker setup to work with composer & laravel & redis & mysql.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published