Skip to content

Commit

Permalink
Added docker files
Browse files Browse the repository at this point in the history
  • Loading branch information
Emre Çalışkan committed Dec 28, 2023
1 parent e43ca34 commit 07c8ecb
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 56 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/frankenphp-docker.yml
Original file line number Diff line number Diff line change
@@ -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
74 changes: 21 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,34 @@
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
## Laravel Benchmark

<p align="center">
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>

## 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
```
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
20 changes: 20 additions & 0 deletions frankenphp.Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
4 changes: 3 additions & 1 deletion openswoole.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
4 changes: 3 additions & 1 deletion roadrunner.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
4 changes: 3 additions & 1 deletion swoole.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

0 comments on commit 07c8ecb

Please sign in to comment.