Sign inSign up

mrmaradi/laravel-app

By mrmaradi

•Updated 10 months ago

Production-ready Laravel 12 Docker image with PHP 8.3 and all essential tools.

Image
Languages & frameworks
0

1.5K

mrmaradi/laravel-app repository overview

⁠🐳 Laravel 12 Docker Image

Docker Pulls Docker Image Size License PHP Laravel

A production-grade Docker image for Laravel 12 applications with PHP 8.3, built for developers.

Quick Start⁠ • Features⁠ • Documentation⁠ • Support⁠


⁠🚀 Quick Start

# Development mode (with live reload)
docker run -d -p 8181:8181 \
  --name laravel-app \
  -v $(pwd)/row-laravel:/app \
  mrmaradi/laravel-app:latest

# Visit http://localhost:8181

---
✨ Features

| Feature                  | Status                  |
|--------------------------|-------------------------|
| PHP Version              | 8.3 ✅                  |
| Laravel Framework        | 12.0+ ✅                |
| Development Server       | Built-in ✅             |
| MySQL/PostgreSQL Support | ✅                      |
| Composer                 | Pre-installed ✅        |
| Live Code Reload         | ✅                      |
| Testing Tools            | PHPUnit 11.5+ ✅        |
| Code Quality             | Pint/Pail ✅            |
| Frontend Build Tools     | Vite + npm ✅           |
| Database Drivers         | PDO MySQL/PostgreSQL ✅ |

---
📦 What's Included

Core Stack

- PHP 8.3 - Latest stable release
- Laravel Framework 12.0 - Full-featured web framework
- Composer - PHP package manager
- Apache 2 Ready - Can upgrade for production

PHP Extensions

✓ PDO MySQL        ✓ PDO PostgreSQL
✓ BCMath           ✓ mbstring
✓ OpenSSL          ✓ Zip/Unzip

Development Tools

- PHPUnit 11.5.3 - Unit testing
- Faker 1.23 - Test data generation
- Pint 1.24 - Code formatting & linting
- Pail 1.2.2 - Log viewer
- Tinker - Interactive PHP shell
- Collision 8.6 - Beautiful error handling

Frontend Tools

- Vite - Lightning-fast build tool
- npm - JavaScript package manager
- Node.js - JavaScript runtime

---
🎯 Use Cases

| Use Case           | ✅ Supported  |
|--------------------|---------------|
| Local Development  | ✅ Perfect    |
| Rapid Prototyping  | ✅ Great      |
| Learning Laravel   | ✅ Ideal      |
| Team Collaboration | ✅ Built-in   |
| Testing & QA       | ✅ Included   |
| Small Projects     | ✅ Optimized  |
| Microservices      | ✅ Compatible |

---
🏗️ Installation & Setup

Prerequisite

# Verify Docker is installed
docker --version
docker-compose --version

Pull Image

docker pull mrmaradi/laravel-app:latest

Development Mode

docker run -d \
  --name laravel-app \
  -p 8181:8181 \
  -v $(pwd)/row-laravel:/app \
  -e APP_DEBUG=true \
  mrmaradi/laravel-app:latest

Access: http://localhost:8181

Production Mode

docker run -d \
  --name laravel-app \
  -p 8181:8181 \
  -e APP_DEBUG=false \
  -e APP_ENV=production \
  mrmaradi/laravel-app:latest

---
📚 Common Tasks

Database Migrations

docker exec laravel-app php artisan migrate
docker exec laravel-app php artisan migrate:fresh --seed

Run Tests

docker exec laravel-app php artisan test
docker exec laravel-app composer test

Create New Resources

# Model
docker exec laravel-app php artisan make:model Post

# Controller
docker exec laravel-app php artisan make:controller PostController

# Migration
docker exec laravel-app php artisan make:migration create_posts_table

# Seeder
docker exec laravel-app php artisan make:seeder PostSeeder

Interactive Shell

# PHP REPL (Tinker)
docker exec laravel-app php artisan tinker

# Bash shell
docker exec -it laravel-app bash

Cache & Config

docker exec laravel-app php artisan cache:clear
docker exec laravel-app php artisan config:clear
docker exec laravel-app php artisan view:clear

View Logs

# Real-time logs
docker exec laravel-app php artisan pail

# Docker logs
docker logs -f laravel-app

Frontend Assets

# Install dependencies
docker exec laravel-app npm install

# Development build
docker exec laravel-app npm run dev

# Production build
docker exec laravel-app npm run build

---
⚙️ Environment Configuration

Basic Setup

docker run -d -p 8181:8181 \
  -e APP_NAME="My App" \
  -e APP_ENV="local" \
  -e APP_DEBUG="true" \
  mrmaradi/laravel-app:latest

Database Connection

docker run -d -p 8181:8181 \
  -e DB_CONNECTION="mysql" \
  -e DB_HOST="mysql-container" \
  -e DB_PORT="3306" \
  -e DB_DATABASE="laravel" \
  -e DB_USERNAME="laravel" \
  -e DB_PASSWORD="secret" \
  mrmaradi/laravel-app:latest

Redis Cache

docker run -d -p 8181:8181 \
  -e CACHE_DRIVER="redis" \
  -e REDIS_HOST="redis-container" \
  -e REDIS_PASSWORD="null" \
  -e REDIS_PORT="6379" \
  mrmaradi/laravel-app:latest

Complete Example

docker run -d \
  --name laravel-app \
  -p 8181:8181 \
  -v $(pwd)/row-laravel:/app \
  -e APP_NAME="MyApp" \
  -e APP_ENV="local" \
  -e APP_DEBUG="true" \
  -e APP_URL="http://localhost:8181" \
  -e DB_CONNECTION="mysql" \
  -e DB_HOST="db" \
  -e DB_PORT="3306" \
  -e DB_DATABASE="laravel" \
  -e DB_USERNAME="laravel" \
  -e DB_PASSWORD="secret" \
  -e CACHE_DRIVER="redis" \
  mrmaradi/laravel-app:latest

---
🐳 Docker Compose Example

Create docker-compose.yml:

version: '3.8'

services:
  app:
    image: mrmaradi/laravel-app:latest
    container_name: laravel-app
    ports:
      - "8181:8181"
    volumes:
      - ./row-laravel:/app
    environment:
      - APP_DEBUG=true
      - DB_CONNECTION=mysql
      - DB_HOST=db
      - DB_USERNAME=laravel
      - DB_PASSWORD=secret
    depends_on:
      - db

  db:
    image: mysql:8.0
    container_name: laravel-db
    ports:
      - "3306:3306"
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: laravel
      MYSQL_USER: laravel
      MYSQL_PASSWORD: secret
    volumes:
      - mysql_data:/var/lib/mysql

volumes:
  mysql_data:

Run:
docker-compose up -d

---
📋 Project Structure

row-laravel/
├── app/
│   ├── Http/Controllers/     # Application controllers
│   ├── Models/               # Eloquent models
│   └── ...
├── config/                   # Configuration files
├── database/
│   ├── migrations/           # Database migrations
│   ├── seeders/              # Database seeders
│   └── factories/            # Model factories
├── resources/
│   ├── views/                # Blade templates
│   ├── js/                   # JavaScript files
│   └── css/                  # Stylesheets
├── routes/
│   ├── web.php               # Web routes
│   ├── api.php               # API routes
│   └── console.php           # Artisan commands
├── storage/                  # Logs, cache, uploads
├── tests/                    # Test files
├── .env                      # Environment variables
├── composer.json             # PHP dependencies
└── package.json              # JavaScript dependencies

---
🔒 Supported Tags

| Tag    | Description             |
|--------|-------------------------|
| latest | Latest stable version   |
| 12.0   | Laravel 12.0 specific   |
| 12     | Laravel 12 latest patch |

---
📊 Performance

- Image Size: ~800MB (optimized)
- Startup Time: <2 seconds
- Memory Usage: ~150MB idle
- PHP Performance: Full 8.3 capabilities

---
🐛 Troubleshooting

Port Already in Use

docker run -d -p 8182:8181 mrmaradi/laravel-app
# Access: http://localhost:8182

Permission Issues

docker exec laravel-app chown -R www-data:www-data /app/storage
docker exec laravel-app chmod -R 775 /app/storage

Database Connection Failed

# Check if database container is running
docker ps | grep db

# Check logs
docker logs laravel-app

Clear All Caches

docker exec laravel-app php artisan optimize:clear

---
📖 Documentation

- Laravel Docs: https://laravel.com/docs/12.x
- Docker Docs: https://docs.docker.com
- PHP 8.3 Docs: https://www.php.net/manual/en/

---
🤝 Support

Having issues?
1. Check the #-troubleshooting section
2. Review Laravel documentation
3. Check Docker logs: docker logs laravel-app

---
📜 License

This image is licensed under the MIT License

---
🙏 Credits

Built with ❤️ for Laravel developers

Laravel © Taylor Otwell
PHP © The PHP Group
Docker © Docker Inc.

---
Made with ❤️ by https://hub.docker.com/u/mrmaradi

⭐ Star on Docker Hub | 🐛 Report Issues | 📧 Contact Support

---

Tag summary

Content type

Image

Digest

sha256:492148737…

Size

451.8 MB

Last updated

10 months ago

docker pull mrmaradi/laravel-app