Skip to content

Commit

Permalink
Merge pull request #20 from shyim/add-frankenphp-image
Browse files Browse the repository at this point in the history
ci: add drop-in docker image for frankenphp
  • Loading branch information
shyim authored Apr 5, 2024
2 parents 4ff2644 + 8d1e001 commit fc5aa8e
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 3 deletions.
34 changes: 32 additions & 2 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/packages
/*.rsa
/*.pub
/repositories
/repositories
/public
File renamed without changes.
54 changes: 54 additions & 0 deletions images/frankenphp/Caddyfile
Original file line number Diff line number Diff line change
@@ -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
}
35 changes: 35 additions & 0 deletions images/frankenphp/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM ghcr.io/shyim/wolfi-php/base:latest

ARG PHP_VERSION=8.2

RUN <<EOF
set -eo pipefail
apk add --no-cache \
curl \
frankenphp-${PHP_VERSION}
EOF

COPY Caddyfile /etc/caddy/Caddyfile

# See https://caddyserver.com/docs/conventions#file-locations for details
ENV XDG_CONFIG_HOME /config
ENV XDG_DATA_HOME /data

EXPOSE 80
EXPOSE 443
EXPOSE 443/udp
EXPOSE 2019

LABEL org.opencontainers.image.title=FrankenPHP
LABEL org.opencontainers.image.description="The modern PHP app server"
LABEL org.opencontainers.image.url=https://frankenphp.dev
LABEL org.opencontainers.image.source=https://github.com/shyim/wolfi-php
LABEL org.opencontainers.image.licenses=MIT
LABEL org.opencontainers.image.vendor="Shyim"

WORKDIR /app
EXPOSE 8000

ENTRYPOINT [ "/usr/bin/frankenphp", "run" ]
CMD [ "--config", "/etc/caddy/Caddyfile" ]
HEALTHCHECK CMD curl -f http://localhost:2019/metrics || exit 1

0 comments on commit fc5aa8e

Please sign in to comment.