Skip to content

Latest commit

 

History

History
60 lines (42 loc) · 1.26 KB

docker.md

File metadata and controls

60 lines (42 loc) · 1.26 KB

📦 Deployment using Docker

This application can be deployed using Docker with docker-compose.yml.

1️⃣ Install Docker

Ensure you have Docker & Docker Compose installed:

2️⃣ Setup Docker Containers

The docker-compose.yml file defines:

  • PHP Laravel App (app)
  • Nginx Web Server (web)
  • MySQL Database (db)

3️⃣ Create .env for Docker

Modify the .env file for the Docker-based database:

DB_CONNECTION=mysql
DB_HOST=db
DB_PORT=3306
DB_DATABASE=trips_laravel_api
DB_USERNAME=trips_laravel_api
DB_PASSWORD=trips_laravel_api

4️⃣ Start Containers

Run the following command:

docker-compose up -d

This will:

  • Start the Laravel application (app)
  • Start MySQL (db) on port 3308
  • Start Nginx (web) on port 8000

5️⃣ Run Migrations & Seeders

After the containers are running, execute:

docker exec -it trips_laravel_app php artisan migrate --seed

6️⃣ Access the Application

7️⃣ Stopping & Removing Containers

docker-compose down