diff --git a/.docker/php/Dockerfile b/.docker/php/Dockerfile index d40de5dd..84ee6485 100644 --- a/.docker/php/Dockerfile +++ b/.docker/php/Dockerfile @@ -1,30 +1,44 @@ -FROM php:8.2-fpm +FROM php:8.4-fpm COPY php.ini /usr/local/etc/php/ COPY docker.conf /usr/local/etc/php-fpm.d/docker.conf COPY .bashrc /root/ +# Copy the entrypoint script +COPY entrypoint.sh /usr/local/bin/entrypoint.sh +RUN chmod +x /usr/local/bin/entrypoint.sh + +# mix RUN apt-get update \ && apt-get install -y build-essential zlib1g-dev default-mysql-client curl gnupg procps vim git unzip libzip-dev libpq-dev \ && docker-php-ext-install zip pdo_mysql pdo_pgsql pgsql +# intl RUN apt-get install -y libicu-dev \ && docker-php-ext-configure intl \ && docker-php-ext-install intl +# gd +RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev && \ +docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ && \ +docker-php-ext-install gd + # redis RUN pecl install redis && docker-php-ext-enable redis # pcov RUN pecl install pcov && docker-php-ext-enable pcov +# pcntl +RUN docker-php-ext-install pcntl + # Xdebug # RUN pecl install xdebug \ # && docker-php-ext-enable xdebug \ # && echo ";zend_extension=xdebug" > /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini # Node.js, NPM, Yarn -RUN curl -sL https://deb.nodesource.com/setup_18.x | bash - +RUN curl -sL https://deb.nodesource.com/setup_22.x | bash - RUN apt-get install -y nodejs RUN npm install npm@latest -g RUN npm install yarn -g @@ -46,3 +60,7 @@ RUN git clone https://github.com/seebi/dircolors-solarized EXPOSE 5173 WORKDIR /var/www + +#entrypoint +ENTRYPOINT ["entrypoint.sh"] +CMD ["php-fpm"] \ No newline at end of file diff --git a/.docker/php/entrypoint.sh b/.docker/php/entrypoint.sh new file mode 100644 index 00000000..99b8f612 --- /dev/null +++ b/.docker/php/entrypoint.sh @@ -0,0 +1,13 @@ +#!/bin/sh +set -e + +# Set permissions for Laravel directories +chown -R www-data:www-data /var/www/storage /var/www/bootstrap/cache +chmod -R 775 /var/www/storage /var/www/bootstrap/cache + +# permissions for PHPMyAdmin +mkdir -p /sessions + +chmod 777 /sessions + +exec "$@" \ No newline at end of file diff --git a/.env.example b/.env.example index 3c7a88c0..6be969ab 100644 --- a/.env.example +++ b/.env.example @@ -4,7 +4,19 @@ APP_KEY= APP_DEBUG=true APP_URL=http://localhost +APP_LOCALE=en +APP_FALLBACK_LOCALE=en +APP_FAKER_LOCALE=en_US + +APP_MAINTENANCE_DRIVER=file +# APP_MAINTENANCE_STORE=database + +PHP_CLI_SERVER_WORKERS=4 + +BCRYPT_ROUNDS=12 + LOG_CHANNEL=stack +LOG_STACK=single LOG_DEPRECATIONS_CHANNEL=null LOG_LEVEL=debug @@ -15,25 +27,31 @@ DB_DATABASE=refactorian DB_USERNAME=refactorian DB_PASSWORD=refactorian -BROADCAST_DRIVER=log -CACHE_DRIVER=file -FILESYSTEM_DISK=local -QUEUE_CONNECTION=sync -SESSION_DRIVER=file +SESSION_DRIVER=database SESSION_LIFETIME=120 +SESSION_ENCRYPT=false +SESSION_PATH=/ +SESSION_DOMAIN=null + +BROADCAST_CONNECTION=log +FILESYSTEM_DISK=local +QUEUE_CONNECTION=database + +CACHE_STORE=database +# CACHE_PREFIX= MEMCACHED_HOST=127.0.0.1 +REDIS_CLIENT=phpredis REDIS_HOST=redis REDIS_PASSWORD=null REDIS_PORT=6379 MAIL_MAILER=smtp -MAIL_HOST=mailpit +MAIL_HOST=mail MAIL_PORT=1025 MAIL_USERNAME=null MAIL_PASSWORD=null -MAIL_ENCRYPTION=null MAIL_FROM_ADDRESS="hello@example.com" MAIL_FROM_NAME="${APP_NAME}" @@ -43,17 +61,4 @@ AWS_DEFAULT_REGION=us-east-1 AWS_BUCKET= AWS_USE_PATH_STYLE_ENDPOINT=false -PUSHER_APP_ID= -PUSHER_APP_KEY= -PUSHER_APP_SECRET= -PUSHER_HOST= -PUSHER_PORT=443 -PUSHER_SCHEME=https -PUSHER_APP_CLUSTER=mt1 - VITE_APP_NAME="${APP_NAME}" -VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}" -VITE_PUSHER_HOST="${PUSHER_HOST}" -VITE_PUSHER_PORT="${PUSHER_PORT}" -VITE_PUSHER_SCHEME="${PUSHER_SCHEME}" -VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 2edf26f9..49288bae 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,7 +9,17 @@ updates: directory: "/" schedule: interval: "weekly" + groups: + production-dependencies: + dependency-type: "production" + development-dependencies: + dependency-type: "development" - package-ecosystem: "npm" directory: "/" schedule: interval: "weekly" + groups: + production-dependencies: + dependency-type: "production" + development-dependencies: + dependency-type: "development" diff --git a/.github/workflows/laravel.yml b/.github/workflows/laravel.yml index 30b2d139..fbac4f87 100644 --- a/.github/workflows/laravel.yml +++ b/.github/workflows/laravel.yml @@ -2,9 +2,9 @@ name: Laravel on: push: - branches: [ "main" ] + branches: [ "*" ] pull_request: - branches: [ "main" ] + branches: [ "*" ] jobs: laravel-tests: @@ -28,8 +28,8 @@ jobs: run: | mkdir -p database touch database/database.sqlite - - name: Execute tests (Unit and Feature tests) via PHPUnit + - name: Execute tests (Unit and Feature tests) via Pest env: DB_CONNECTION: sqlite DB_DATABASE: database/database.sqlite - run: vendor/bin/phpunit + run: ./vendor/bin/pest diff --git a/README.md b/README.md index cb4b3966..44e5e6cd 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,12 @@ -
+ # Laravel Docker Starter Kit -- Laravel v10.x -- PHP v8.2.x -- MySQL v8.1 -- MariaDB v10.11 +- Laravel v12.x +- PHP v8.4.x +- MySQL v8.1.x (default) +- MariaDB v10.11.x +- PostgreSQL v16.x +- pgAdmin v4.x - phpMyAdmin v5.x - Mailpit v1.x - Node.js v18.x @@ -21,6 +23,8 @@ # How To Deploy ### For first time only ! +- `git clone https://github.com/refactorian/laravel-docker.git` +- `cd laravel-docker` - `docker compose up -d --build` - `docker compose exec php bash` - `composer setup` @@ -30,9 +34,17 @@ # Notes +### Laravel Versions +- [Laravel 12.x](https://github.com/refactorian/laravel-docker/tree/main) +- [Laravel 11.x](https://github.com/refactorian/laravel-docker/tree/laravel_11x) +- [Laravel 10.x](https://github.com/refactorian/laravel-docker/tree/laravel_10x) + ### Laravel App - URL: http://localhost +### Mailpit +- URL: http://localhost:8025 + ### phpMyAdmin - URL: http://localhost:8080 - Server: `db` @@ -104,66 +116,7 @@ - Process - `vendor/bin/rector process` -# TODO -- Improve environment -- Add more containers - ---- - -## About Laravel - -Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as: - -- [Simple, fast routing engine](https://laravel.com/docs/routing). -- [Powerful dependency injection container](https://laravel.com/docs/container). -- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage. -- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent). -- Database agnostic [schema migrations](https://laravel.com/docs/migrations). -- [Robust background job processing](https://laravel.com/docs/queues). -- [Real-time event broadcasting](https://laravel.com/docs/broadcasting). - -Laravel is accessible, powerful, and provides tools required for large, robust applications. - -## Learning Laravel - -Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework. - -You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch. - -If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 2000 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library. - -## Laravel Sponsors - -We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell). - -### Premium Partners - -- **[Vehikl](https://vehikl.com/)** -- **[Tighten Co.](https://tighten.co)** -- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)** -- **[64 Robots](https://64robots.com)** -- **[Cubet Techno Labs](https://cubettech.com)** -- **[Cyber-Duck](https://cyber-duck.co.uk)** -- **[Many](https://www.many.co.uk)** -- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)** -- **[DevSquad](https://devsquad.com)** -- **[Curotec](https://www.curotec.com/services/technologies/laravel/)** -- **[OP.GG](https://op.gg)** -- **[WebReinvent](https://webreinvent.com/?utm_source=laravel&utm_medium=github&utm_campaign=patreon-sponsors)** -- **[Lendio](https://lendio.com)** - -## Contributing - -Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions). - -## Code of Conduct - -In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct). - -## Security Vulnerabilities - -If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed. - -## License - -The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT). +# Alternatives +- [Laravel Sail](https://laravel.com/docs/master/sail) +- [Laravel Herd](https://herd.laravel.com/) +- [Laradock](https://laradock.io/) \ No newline at end of file diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php deleted file mode 100644 index e6b9960e..00000000 --- a/app/Console/Kernel.php +++ /dev/null @@ -1,27 +0,0 @@ -command('inspire')->hourly(); - } - - /** - * Register the commands for the application. - */ - protected function commands(): void - { - $this->load(__DIR__.'/Commands'); - - require base_path('routes/console.php'); - } -} diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php deleted file mode 100644 index 56af2640..00000000 --- a/app/Exceptions/Handler.php +++ /dev/null @@ -1,30 +0,0 @@ - - */ - protected $dontFlash = [ - 'current_password', - 'password', - 'password_confirmation', - ]; - - /** - * Register the exception handling callbacks for the application. - */ - public function register(): void - { - $this->reportable(function (Throwable $e) { - // - }); - } -} diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 77ec359a..8677cd5c 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -2,11 +2,7 @@ namespace App\Http\Controllers; -use Illuminate\Foundation\Auth\Access\AuthorizesRequests; -use Illuminate\Foundation\Validation\ValidatesRequests; -use Illuminate\Routing\Controller as BaseController; - -class Controller extends BaseController +abstract class Controller { - use AuthorizesRequests, ValidatesRequests; + // } diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php deleted file mode 100644 index 494c0501..00000000 --- a/app/Http/Kernel.php +++ /dev/null @@ -1,68 +0,0 @@ - - */ - protected $middleware = [ - // \App\Http\Middleware\TrustHosts::class, - \App\Http\Middleware\TrustProxies::class, - \Illuminate\Http\Middleware\HandleCors::class, - \App\Http\Middleware\PreventRequestsDuringMaintenance::class, - \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, - \App\Http\Middleware\TrimStrings::class, - \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, - ]; - - /** - * The application's route middleware groups. - * - * @var array- Laravel has wonderful documentation covering every aspect of the framework. Whether you are a newcomer or have prior experience with Laravel, we recommend reading our documentation from beginning to end. -
-- Laracasts offers thousands of video tutorials on Laravel, PHP, and JavaScript development. Check them out, see for yourself, and massively level up your development skills in the process. -
-