diff --git a/.github/workflows/frankenphp-docker.yml b/.github/workflows/frankenphp-docker.yml new file mode 100644 index 0000000..f1c6c2a --- /dev/null +++ b/.github/workflows/frankenphp-docker.yml @@ -0,0 +1,48 @@ +# +name: Create and publish a FrankenPHP Docker image + +# Configures this workflow to run every time a change is pushed to the branch called `release`. +on: + push: + branches: ['master'] + +# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds. +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu. +jobs: + build-and-push-image: + runs-on: ubuntu-latest + # Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. + permissions: + contents: read + packages: write + # + steps: + - name: Checkout repository + uses: actions/checkout@v4 + # Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here. + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + # This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels. + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + # This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages. + # It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository. + # It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step. + - name: Build and push Docker image + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 + with: + context: . + file: ./frankenphp.Dockerfile + push: true + tags: ghcr.io/thecaliskan/laravel-benchmark:frankenphp diff --git a/README.md b/README.md index 1824fc1..0901c8e 100644 --- a/README.md +++ b/README.md @@ -1,66 +1,34 @@ -
+## Laravel Benchmark - -## About Laravel +### OpenSwoole -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: +```bash +docker run -p 9801:9801/tcp ghcr.io/thecaliskan/laravel-benchmark:openswoole -- [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). +wrk -t8 -c16 -d30s --latency http://127.0.0.1:9801/api/health-check +``` -Laravel is accessible, powerful, and provides tools required for large, robust applications. +### Swoole -## Learning Laravel +```bash +docker run -p 9802:9802/tcp ghcr.io/thecaliskan/laravel-benchmark:swoole -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. +wrk -t8 -c16 -d30s --latency http://127.0.0.1:9802/api/health-check +``` -You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch. +### RoadRunner -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. +```bash +docker run -p 9803:9803/tcp ghcr.io/thecaliskan/laravel-benchmark:roadrunner -## Laravel Sponsors +wrk -t8 -c16 -d30s --latency http://127.0.0.1:9803/api/health-check +``` -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 Partners program](https://partners.laravel.com). +### FrankenPHP -### Premium Partners +```bash +docker run -p 9804:9804/tcp ghcr.io/thecaliskan/laravel-benchmark:frankenphp -- **[Vehikl](https://vehikl.com/)** -- **[Tighten Co.](https://tighten.co)** -- **[WebReinvent](https://webreinvent.com/)** -- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)** -- **[64 Robots](https://64robots.com)** -- **[Curotec](https://www.curotec.com/services/technologies/laravel/)** -- **[Cyber-Duck](https://cyber-duck.co.uk)** -- **[DevSquad](https://devsquad.com/hire-laravel-developers)** -- **[Jump24](https://jump24.co.uk)** -- **[Redberry](https://redberry.international/laravel/)** -- **[Active Logic](https://activelogic.com)** -- **[byte5](https://byte5.de)** -- **[OP.GG](https://op.gg)** - -## 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). +wrk -t8 -c16 -d30s --latency http://127.0.0.1:9804/api/health-check +``` diff --git a/composer.json b/composer.json index 863665d..217456f 100644 --- a/composer.json +++ b/composer.json @@ -49,6 +49,9 @@ ], "post-create-project-cmd": [ "@php artisan key:generate --ansi" + ], + "env-generate": [ + "@php -r \"file_exists('.env') || copy('.env.example', '.env');@php artisan key:generate --ansi" ] }, "extra": { diff --git a/frankenphp.Dockerfile b/frankenphp.Dockerfile new file mode 100644 index 0000000..898dedf --- /dev/null +++ b/frankenphp.Dockerfile @@ -0,0 +1,20 @@ +FROM php:8.3-alpine + +COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ +COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer + +RUN install-php-extensions pcntl sockets + +COPY . /var/www + +WORKDIR /var/www + +RUN apk add jq + +RUN wget -Ofrankenphp $(wget -O- https://api.github.com/repos/dunglas/frankenphp/releases/latest | jq '.assets[] | select(.name=="frankenphp-linux-x86_64") | .browser_download_url' -r) + +RUN composer install --no-dev + +RUN composer env-generate + +ENTRYPOINT ["php", "artisan", "octane:start", "--server=frankenphp", "--port=9804", "--workers=16", "--host=0.0.0.0"] diff --git a/openswoole.Dockerfile b/openswoole.Dockerfile index ddc0d4c..b895cc1 100644 --- a/openswoole.Dockerfile +++ b/openswoole.Dockerfile @@ -11,4 +11,6 @@ WORKDIR /var/www RUN composer install --no-dev -ENTRYPOINT ["php", "artisan", "octane:start", "--server=swoole", "--port=8000", "--workers=16", "--host=0.0.0.0"] +RUN composer env-generate + +ENTRYPOINT ["php", "artisan", "octane:start", "--server=swoole", "--port=9801", "--workers=16", "--host=0.0.0.0"] diff --git a/roadrunner.Dockerfile b/roadrunner.Dockerfile index a8817ff..d3d0bbf 100644 --- a/roadrunner.Dockerfile +++ b/roadrunner.Dockerfile @@ -12,4 +12,6 @@ WORKDIR /var/www RUN composer install --no-dev -ENTRYPOINT ["php", "artisan", "octane:start", "--server=roadrunner", "--port=8080", "--workers=16", "--host=0.0.0.0"] +RUN composer env-generate + +ENTRYPOINT ["php", "artisan", "octane:start", "--server=roadrunner", "--port=9803", "--workers=16", "--host=0.0.0.0"] diff --git a/swoole.Dockerfile b/swoole.Dockerfile index 010b432..d00e812 100644 --- a/swoole.Dockerfile +++ b/swoole.Dockerfile @@ -11,4 +11,6 @@ WORKDIR /var/www RUN composer install --no-dev -ENTRYPOINT ["php", "artisan", "octane:start", "--server=swoole", "--port=8000", "--workers=16", "--host=0.0.0.0"] +RUN composer env-generate + +ENTRYPOINT ["php", "artisan", "octane:start", "--server=swoole", "--port=9802", "--workers=16", "--host=0.0.0.0"]