Working with docker environment requires installation below tools on workstation
- docker
- docker-compose
- composer
-
New project starts with framework cloning
git clone https://github.com/laravel/laravel.git
-
Go to project directory in project
cd /path/to/laravel/project
-
Remove git history
rm -rf .git
-
Reinitial repository
git init
-
Add first commit
git add . && git commit -m 'init'
-
Add remote repository.
git remote add origin https://remote.repository.git
-
Push initial commit to remote repository
git push origin master
-
Download ZIP version of this repository.
-
Extract ZIP and put docker directory to project.
-
Fill environment variables in
.env.example
Caution:
Filling environment variables .env.example should pairing with docker compose configuration
Use this repository sample .env.example
-
Clone project repository to local workstation
git clone https://remote.repository.git
-
Move to project directory
cd /path/to/project
-
Switch to develop branch if existing
git checkout develop
-
Make you own environment
cp .env.example .env
Caution:
Sample environment variables .env.example should pairing with docker compose configuration
Don't need to make any changes
-
Move to docker directory in project
cd /path/to/project/docker
-
Build docker environment
docker-compose build
-
Up and running docker environment
docker-compose up -d
-
Make you own environment
cp .env.example .env
-
Move to docker directory in project
cd /path/to/project/docker
-
Build docker environment
docker-compose build
-
Up and running docker environment
docker-compose up -d
- Install dependencies
docker exec -it ${project-name}-backend composer install
${project-name} is your project name, check by docker ps
- Generate api key
docker exec -it ${project-name}-backend php artisan key:generate
- Visit welcome page laravel.docker (127.17.0.1)