This application can be deployed using Docker with docker-compose.yml
.
Ensure you have Docker & Docker Compose installed:
The docker-compose.yml
file defines:
- PHP Laravel App (
app
) - Nginx Web Server (
web
) - MySQL Database (
db
)
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
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
After the containers are running, execute:
docker exec -it trips_laravel_app php artisan migrate --seed
- API: http://localhost:8000
- Database:
mysql://localhost:3308
docker-compose down