Dockerized Laravel9 Project
Docker Images
php:8.1-fpm
|
mysql:8.0
|
phpmyadmin/phpmyadmin
|
nginx:latest
|
redis:3.0
- Clone the repo
git clone https://github.com/gihandilanka-github/laravel-microservice-projectB.git
- Go inside the cloned directory
cd laravel-microservice-projectB
- Configure the
.env
filecp .env.example .env
- Run this command to up docker containers
docker-compose up -d --build
- Run composer install
docker-compose exec app composer install
- Generate APP_KEY in .
env
docker-compose exec app php artisan key:generate
- Run the migrate command to create new tables in database
docker-compose exec app php artisan migrate
- Run seeder to insert customer records to customers table
docker-compose exec app php artisan db:seed --class=CustomerSeeder
- Add these two records to
/etc/hosts
file127.0.0.1 api.microservice-b.test 127.0.0.1 pma.microservice-b.test
- Open the phpmyadmin in the browser. You can see the
microserviceB
databasehttp://pma.microservice-b.test:8083
- Give these laravel directory permissions
sudo chmod -R 777 storage/logs/ sudo chmod -R 777 storage/framework/
- You can check the following API url, it will return the customers as
json
responsehttp://api.microservice-b.test:8084/api/v1/customer/list