From 8d1e00182d23483fd62761f0a0ae4e280596fd7c Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Sat, 6 Apr 2024 00:26:54 +0200 Subject: [PATCH] ci: add drop-in docker image for frankenphp --- .github/workflows/docker.yaml | 34 ++++++++++++++++-- .gitignore | 3 +- Dockerfile => images/base/Dockerfile | 0 images/frankenphp/Caddyfile | 54 ++++++++++++++++++++++++++++ images/frankenphp/Dockerfile | 35 ++++++++++++++++++ 5 files changed, 123 insertions(+), 3 deletions(-) rename Dockerfile => images/base/Dockerfile (100%) create mode 100644 images/frankenphp/Caddyfile create mode 100644 images/frankenphp/Dockerfile diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 29aeb55..7a131b1 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -7,14 +7,14 @@ on: branches: - main paths: - - Dockerfile + - images/* permissions: contents: read packages: write jobs: - build: + base: runs-on: ubuntu-latest steps: - name: Checkout @@ -33,5 +33,35 @@ jobs: with: tags: ghcr.io/shyim/wolfi-php/base:latest platforms: linux/amd64,linux/arm64 + context: images/base push: true provenance: false + + frankenphp: + runs-on: ubuntu-latest + strategy: + matrix: + php: + - 8.2 + - 8.3 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login into Github Docker Registery + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + + - uses: docker/build-push-action@v5 + with: + tags: ghcr.io/shyim/wolfi-php/frankenphp:${{ matrix.php }} + platforms: linux/amd64,linux/arm64 + context: images/frankenphp + build-args: PHP_VERSION=${{ matrix.php }} + push: true + provenance: false diff --git a/.gitignore b/.gitignore index 97b54ba..3654a2a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /packages /*.rsa /*.pub -/repositories \ No newline at end of file +/repositories +/public \ No newline at end of file diff --git a/Dockerfile b/images/base/Dockerfile similarity index 100% rename from Dockerfile rename to images/base/Dockerfile diff --git a/images/frankenphp/Caddyfile b/images/frankenphp/Caddyfile new file mode 100644 index 0000000..987bf6a --- /dev/null +++ b/images/frankenphp/Caddyfile @@ -0,0 +1,54 @@ +{ + {$CADDY_GLOBAL_OPTIONS} + + frankenphp { + #worker /path/to/your/worker.php + {$FRANKENPHP_CONFIG} + } + + # https://caddyserver.com/docs/caddyfile/directives#sorting-algorithm + order mercure after encode + order vulcain after reverse_proxy + order php_server before file_server + order php before file_server +} + +{$CADDY_EXTRA_CONFIG} + +{$SERVER_NAME:localhost} { + #log { + # # Redact the authorization query parameter that can be set by Mercure + # format filter { + # wrap console + # fields { + # uri query { + # replace authorization REDACTED + # } + # } + # } + #} + + root * public/ + encode zstd br gzip + + # Uncomment the following lines to enable Mercure and Vulcain modules + #mercure { + # # Transport to use (default to Bolt) + # transport_url {$MERCURE_TRANSPORT_URL:bolt:///data/mercure.db} + # # Publisher JWT key + # publisher_jwt {env.MERCURE_PUBLISHER_JWT_KEY} {env.MERCURE_PUBLISHER_JWT_ALG} + # # Subscriber JWT key + # subscriber_jwt {env.MERCURE_SUBSCRIBER_JWT_KEY} {env.MERCURE_SUBSCRIBER_JWT_ALG} + # # Allow anonymous subscribers (double-check that it's what you want) + # anonymous + # # Enable the subscription API (double-check that it's what you want) + # subscriptions + # # Extra directives + # {$MERCURE_EXTRA_DIRECTIVES} + #} + #vulcain + + {$CADDY_SERVER_EXTRA_DIRECTIVES} + + php_server +} \ No newline at end of file diff --git a/images/frankenphp/Dockerfile b/images/frankenphp/Dockerfile new file mode 100644 index 0000000..0cbce5c --- /dev/null +++ b/images/frankenphp/Dockerfile @@ -0,0 +1,35 @@ +FROM ghcr.io/shyim/wolfi-php/base:latest + +ARG PHP_VERSION=8.2 + +RUN <