mirror of
https://github.com/php/frankenphp.git
synced 2026-03-24 00:52:11 +01:00
ci: add Super-Linter (#323)
This commit is contained in:
1
.github/FUNDING.yml
vendored
1
.github/FUNDING.yml
vendored
@@ -1 +0,0 @@
|
|||||||
github: dunglas
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
---
|
||||||
name: Build Docker images
|
name: Build Docker images
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
@@ -31,10 +32,12 @@ jobs:
|
|||||||
name: Create variants matrix
|
name: Create variants matrix
|
||||||
id: matrix
|
id: matrix
|
||||||
run: |
|
run: |
|
||||||
METADATA=$(docker buildx bake --print | jq -c)
|
METADATA="$(docker buildx bake --print | jq -c)"
|
||||||
echo "metadata=$METADATA" >> "$GITHUB_OUTPUT"
|
{
|
||||||
echo "variants=$(jq -c '.group.default.targets|map(sub("runner-|builder-"; ""))|unique' <<< $METADATA)" >> "$GITHUB_OUTPUT"
|
echo metadata="$METADATA"
|
||||||
echo "platforms=$(jq -c 'first(.target[]) | .platforms' <<< $METADATA)" >> "$GITHUB_OUTPUT"
|
echo variants="$(jq -c '.group.default.targets|map(sub("runner-|builder-"; ""))|unique' <<< "$METADATA")"
|
||||||
|
echo platforms="$(jq -c 'first(.target[]) | .platforms' <<< "$METADATA")"
|
||||||
|
} >> "$GITHUB_OUTPUT"
|
||||||
env:
|
env:
|
||||||
LATEST: '1' # TODO: unset this variable when releasing the first stable version
|
LATEST: '1' # TODO: unset this variable when releasing the first stable version
|
||||||
SHA: ${{github.sha}}
|
SHA: ${{github.sha}}
|
||||||
@@ -107,10 +110,10 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
mkdir -p /tmp/metadata/builder /tmp/metadata/runner
|
mkdir -p /tmp/metadata/builder /tmp/metadata/runner
|
||||||
|
|
||||||
builderDigest=$(jq -r '."builder-${{matrix.variant}}"."containerimage.digest"' <<< $METADATA)
|
builderDigest="$(jq -r '."builder-${{matrix.variant}}"."containerimage.digest"' <<< "$METADATA")"
|
||||||
touch "/tmp/metadata/builder/${builderDigest#sha256:}"
|
touch "/tmp/metadata/builder/${builderDigest#sha256:}"
|
||||||
|
|
||||||
runnerDigest=$(jq -r '."runner-${{matrix.variant}}"."containerimage.digest"' <<< $METADATA)
|
runnerDigest="$(jq -r '."runner-${{matrix.variant}}"."containerimage.digest"' <<< "$METADATA")"
|
||||||
touch "/tmp/metadata/runner/${runnerDigest#sha256:}"
|
touch "/tmp/metadata/runner/${runnerDigest#sha256:}"
|
||||||
env:
|
env:
|
||||||
METADATA: ${{steps.build.outputs.metadata}}
|
METADATA: ${{steps.build.outputs.metadata}}
|
||||||
@@ -138,7 +141,7 @@ jobs:
|
|||||||
continue-on-error: ${{fromJson(needs.prepare.outputs.push)}}
|
continue-on-error: ${{fromJson(needs.prepare.outputs.push)}}
|
||||||
run: |
|
run: |
|
||||||
docker run --platform=${{matrix.platform}} --rm \
|
docker run --platform=${{matrix.platform}} --rm \
|
||||||
$(jq -r '."builder-${{matrix.variant}}"."containerimage.config.digest"' <<< $METADATA) \
|
"$(jq -r '."builder-${{matrix.variant}}"."containerimage.config.digest"' <<< "$METADATA")" \
|
||||||
sh -c 'go test ${{matrix.race}} -v ./... && cd caddy && go test ${{matrix.race}} -v ./...'
|
sh -c 'go test ${{matrix.race}} -v ./... && cd caddy && go test ${{matrix.race}} -v ./...'
|
||||||
env:
|
env:
|
||||||
METADATA: ${{steps.build.outputs.metadata}}
|
METADATA: ${{steps.build.outputs.metadata}}
|
||||||
@@ -176,13 +179,12 @@ jobs:
|
|||||||
name: Create manifest list and push
|
name: Create manifest list and push
|
||||||
working-directory: /tmp/metadata
|
working-directory: /tmp/metadata
|
||||||
run: |
|
run: |
|
||||||
docker buildx imagetools create $(jq -cr '.target."${{matrix.target}}-${{matrix.variant}}".tags | map("-t " + .) | join(" ")' <<< $METADATA) \
|
docker buildx imagetools create "$(jq -cr '.target."${{matrix.target}}-${{matrix.variant}}".tags | map("-t " + .) | join(" ")' <<< "$METADATA")" \
|
||||||
$(printf 'dunglas/frankenphp@sha256:%s ' *)
|
"$(printf 'dunglas/frankenphp@sha256:%s ' *)"
|
||||||
env:
|
env:
|
||||||
METADATA: ${{needs.prepare.outputs.metadata}}
|
METADATA: ${{needs.prepare.outputs.metadata}}
|
||||||
-
|
-
|
||||||
name: Inspect image
|
name: Inspect image
|
||||||
run: |
|
run: docker buildx imagetools inspect "$(jq -cr '.target."${{matrix.target}}-${{matrix.variant}}".tags | first' <<< "$METADATA")"
|
||||||
docker buildx imagetools inspect $(jq -cr '.target."${{matrix.target}}-${{matrix.variant}}".tags | first' <<< $METADATA)
|
|
||||||
env:
|
env:
|
||||||
METADATA: ${{needs.prepare.outputs.metadata}}
|
METADATA: ${{needs.prepare.outputs.metadata}}
|
||||||
43
.github/workflows/lint.yaml
vendored
Normal file
43
.github/workflows/lint.yaml
vendored
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
---
|
||||||
|
name: Lint Code Base
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Lint Code Base
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: read
|
||||||
|
statuses: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout Code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
-
|
||||||
|
name: Lint Code Base
|
||||||
|
uses: super-linter/super-linter@v5
|
||||||
|
env:
|
||||||
|
VALIDATE_ALL_CODEBASE: true
|
||||||
|
DEFAULT_BRANCH: main
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
LINTER_RULES_PATH: /
|
||||||
|
FILTER_REGEX_EXCLUDE: '.*C-Thread-Pool/.*'
|
||||||
|
MARKDOWN_CONFIG_FILE: .markdown-lint.yaml
|
||||||
|
VALIDATE_CPP: false
|
||||||
|
VALIDATE_JSCPD: false
|
||||||
|
VALIDATE_GO: false
|
||||||
|
VALIDATE_PHP_PHPCS: false
|
||||||
|
VALIDATE_PHP_PHPSTAN: false
|
||||||
|
VALIDATE_PHP_PSALM: false
|
||||||
|
VALIDATE_TERRAGRUNT: false
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
---
|
||||||
name: Build binary releases
|
name: Build binary releases
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
@@ -52,7 +53,7 @@ jobs:
|
|||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
-
|
-
|
||||||
name: Copy binary
|
name: Copy binary
|
||||||
run: docker cp $(docker create --name static-builder dunglas/frankenphp:static-builder):/go/src/app/dist/frankenphp-linux-x86_64 frankenphp-linux-x86_64 ; docker rm static-builder
|
run: docker cp "$(docker create --name static-builder dunglas/frankenphp:static-builder):/go/src/app/dist/frankenphp-linux-x86_64" frankenphp-linux-x86_64 ; docker rm static-builder
|
||||||
-
|
-
|
||||||
name: Upload asset
|
name: Upload asset
|
||||||
if: github.ref_type == 'tag'
|
if: github.ref_type == 'tag'
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
---
|
||||||
name: Tests
|
name: Tests
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
@@ -52,3 +53,8 @@ jobs:
|
|||||||
name: Run Caddy module tests
|
name: Run Caddy module tests
|
||||||
working-directory: caddy/
|
working-directory: caddy/
|
||||||
run: go test -race -v ./...
|
run: go test -race -v ./...
|
||||||
|
-
|
||||||
|
name: Lint Go code
|
||||||
|
uses: golangci/golangci-lint-action@v3
|
||||||
|
with:
|
||||||
|
version: latest
|
||||||
6
.hadolint.yaml
Normal file
6
.hadolint.yaml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
ignored:
|
||||||
|
- DL3006
|
||||||
|
- DL3008
|
||||||
|
- DL3018
|
||||||
|
- DL3022
|
||||||
4
.markdown-lint.yaml
Normal file
4
.markdown-lint.yaml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
no-hard-tabs: false
|
||||||
|
MD013: false
|
||||||
|
MD033: false
|
||||||
@@ -1,15 +1,20 @@
|
|||||||
# Contributing
|
# Contributing
|
||||||
|
|
||||||
## Compiling PHP
|
## Compiling PHP
|
||||||
|
|
||||||
### With Docker (Linux)
|
### With Docker (Linux)
|
||||||
|
|
||||||
Build the dev Docker image:
|
Build the dev Docker image:
|
||||||
|
|
||||||
docker build -t frankenphp-dev -f dev.Dockerfile .
|
```console
|
||||||
docker run --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -p 8080:8080 -p 443:443 -v $PWD:/go/src/app -it frankenphp-dev
|
docker build -t frankenphp-dev -f dev.Dockerfile .
|
||||||
|
docker run --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -p 8080:8080 -p 443:443 -v $PWD:/go/src/app -it frankenphp-dev
|
||||||
|
```
|
||||||
|
|
||||||
The image contains the usual development tools (Go, GDB, Valgrind, Neovim...).
|
The image contains the usual development tools (Go, GDB, Valgrind, Neovim...).
|
||||||
|
|
||||||
If docker version is lower than 23.0, build is failed by dockerignore [pattern issue](https://github.com/moby/moby/pull/42676). Add directories to `.dockerignore`.
|
If docker version is lower than 23.0, build is failed by dockerignore [pattern issue](https://github.com/moby/moby/pull/42676). Add directories to `.dockerignore`.
|
||||||
|
|
||||||
```patch
|
```patch
|
||||||
!testdata/*.php
|
!testdata/*.php
|
||||||
!testdata/*.txt
|
!testdata/*.txt
|
||||||
@@ -24,65 +29,79 @@ If docker version is lower than 23.0, build is failed by dockerignore [pattern i
|
|||||||
|
|
||||||
## Running the test suite
|
## Running the test suite
|
||||||
|
|
||||||
go test -race -v ./...
|
```console
|
||||||
|
go test -race -v ./...
|
||||||
|
```
|
||||||
|
|
||||||
## Caddy module
|
## Caddy module
|
||||||
|
|
||||||
Build Caddy with the FrankenPHP Caddy module:
|
Build Caddy with the FrankenPHP Caddy module:
|
||||||
|
|
||||||
cd caddy/frankenphp/
|
```console
|
||||||
go build
|
cd caddy/frankenphp/
|
||||||
cd ../../
|
go build
|
||||||
|
cd ../../
|
||||||
|
```
|
||||||
|
|
||||||
Run the Caddy with the FrankenPHP Caddy module:
|
Run the Caddy with the FrankenPHP Caddy module:
|
||||||
|
|
||||||
cd testdata/
|
```console
|
||||||
../caddy/frankenphp/frankenphp run
|
cd testdata/
|
||||||
|
../caddy/frankenphp/frankenphp run
|
||||||
|
```
|
||||||
|
|
||||||
The server is listening on `127.0.0.1:8080`:
|
The server is listening on `127.0.0.1:8080`:
|
||||||
|
|
||||||
curl -vk https://localhost/phpinfo.php
|
```console
|
||||||
|
curl -vk https://localhost/phpinfo.php
|
||||||
|
```
|
||||||
|
|
||||||
## Minimal test server
|
## Minimal test server
|
||||||
|
|
||||||
Build the minimal test server:
|
Build the minimal test server:
|
||||||
|
|
||||||
cd internal/testserver/
|
```console
|
||||||
go build
|
cd internal/testserver/
|
||||||
cd ../../
|
go build
|
||||||
|
cd ../../
|
||||||
|
```
|
||||||
|
|
||||||
Run the test server:
|
Run the test server:
|
||||||
|
|
||||||
cd testdata/
|
```console
|
||||||
../internal/testserver/testserver
|
cd testdata/
|
||||||
|
../internal/testserver/testserver
|
||||||
|
```
|
||||||
|
|
||||||
The server is listening on `127.0.0.1:8080`:
|
The server is listening on `127.0.0.1:8080`:
|
||||||
|
|
||||||
curl -v http://127.0.0.1:8080/phpinfo.php
|
```console
|
||||||
|
curl -v http://127.0.0.1:8080/phpinfo.php
|
||||||
|
```
|
||||||
|
|
||||||
# Building Docker Images Locally
|
## Building Docker Images Locally
|
||||||
|
|
||||||
Print bake plan:
|
Print bake plan:
|
||||||
|
|
||||||
```
|
```console
|
||||||
docker buildx bake -f docker-bake.hcl --print
|
docker buildx bake -f docker-bake.hcl --print
|
||||||
```
|
```
|
||||||
|
|
||||||
Build FrankenPHP images for amd64 locally:
|
Build FrankenPHP images for amd64 locally:
|
||||||
|
|
||||||
```
|
```console
|
||||||
docker buildx bake -f docker-bake.hcl --pull --load --set "*.platform=linux/amd64"
|
docker buildx bake -f docker-bake.hcl --pull --load --set "*.platform=linux/amd64"
|
||||||
```
|
```
|
||||||
|
|
||||||
Build FrankenPHP images for arm64 locally:
|
Build FrankenPHP images for arm64 locally:
|
||||||
|
|
||||||
```
|
```console
|
||||||
docker buildx bake -f docker-bake.hcl --pull --load --set "*.platform=linux/arm64"
|
docker buildx bake -f docker-bake.hcl --pull --load --set "*.platform=linux/arm64"
|
||||||
```
|
```
|
||||||
|
|
||||||
Build FrankenPHP images from scratch for arm64 & amd64 and push to Docker Hub:
|
Build FrankenPHP images from scratch for arm64 & amd64 and push to Docker Hub:
|
||||||
|
|
||||||
```
|
```console
|
||||||
docker buildx bake -f docker-bake.hcl --pull --no-cache --push
|
docker buildx bake -f docker-bake.hcl --pull --no-cache --push
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -90,6 +109,7 @@ docker buildx bake -f docker-bake.hcl --pull --no-cache --push
|
|||||||
|
|
||||||
1. Open `.github/workflows/tests.yml`
|
1. Open `.github/workflows/tests.yml`
|
||||||
2. Enable PHP debug symbols
|
2. Enable PHP debug symbols
|
||||||
|
|
||||||
```patch
|
```patch
|
||||||
- uses: shivammathur/setup-php@v2
|
- uses: shivammathur/setup-php@v2
|
||||||
# ...
|
# ...
|
||||||
@@ -97,7 +117,9 @@ docker buildx bake -f docker-bake.hcl --pull --no-cache --push
|
|||||||
phpts: ts
|
phpts: ts
|
||||||
+ debug: true
|
+ debug: true
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Enable `tmate` to connect to the container
|
3. Enable `tmate` to connect to the container
|
||||||
|
|
||||||
```patch
|
```patch
|
||||||
-
|
-
|
||||||
name: Set CGO flags
|
name: Set CGO flags
|
||||||
@@ -110,19 +132,24 @@ docker buildx bake -f docker-bake.hcl --pull --no-cache --push
|
|||||||
+ -
|
+ -
|
||||||
+ uses: mxschmitt/action-tmate@v3
|
+ uses: mxschmitt/action-tmate@v3
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Connect to the container
|
4. Connect to the container
|
||||||
5. Open `frankenphp.go`
|
5. Open `frankenphp.go`
|
||||||
6. Enable `cgosymbolizer`
|
6. Enable `cgosymbolizer`
|
||||||
|
|
||||||
```patch
|
```patch
|
||||||
- //_ "github.com/ianlancetaylor/cgosymbolizer"
|
- //_ "github.com/ianlancetaylor/cgosymbolizer"
|
||||||
+ _ "github.com/ianlancetaylor/cgosymbolizer"
|
+ _ "github.com/ianlancetaylor/cgosymbolizer"
|
||||||
```
|
```
|
||||||
|
|
||||||
7. Download the module: `go get`
|
7. Download the module: `go get`
|
||||||
8. In the container, you can use GDB and the like:
|
8. In the container, you can use GDB and the like:
|
||||||
```sh
|
|
||||||
|
```console
|
||||||
go test -c -ldflags=-w
|
go test -c -ldflags=-w
|
||||||
gdb --args ./frankenphp.test -test.run ^MyTest$
|
gdb --args ./frankenphp.test -test.run ^MyTest$
|
||||||
```
|
```
|
||||||
|
|
||||||
9. When the bug is fixed, revert all these changes
|
9. When the bug is fixed, revert all these changes
|
||||||
|
|
||||||
## Misc Dev Resources
|
## Misc Dev Resources
|
||||||
@@ -142,10 +169,9 @@ docker buildx bake -f docker-bake.hcl --pull --no-cache --push
|
|||||||
* [Bake file definition](https://docs.docker.com/build/customize/bake/file-definition/)
|
* [Bake file definition](https://docs.docker.com/build/customize/bake/file-definition/)
|
||||||
* [docker buildx build](https://docs.docker.com/engine/reference/commandline/buildx_build/)
|
* [docker buildx build](https://docs.docker.com/engine/reference/commandline/buildx_build/)
|
||||||
|
|
||||||
|
|
||||||
## Useful Command
|
## Useful Command
|
||||||
|
|
||||||
```
|
```console
|
||||||
apk add strace util-linux gdb
|
apk add strace util-linux gdb
|
||||||
strace -e 'trace=!futex,epoll_ctl,epoll_pwait,tgkill,rt_sigreturn' -p 1
|
strace -e 'trace=!futex,epoll_ctl,epoll_pwait,tgkill,rt_sigreturn' -p 1
|
||||||
```
|
```
|
||||||
|
|||||||
16
Dockerfile
16
Dockerfile
@@ -46,6 +46,7 @@ LABEL org.opencontainers.image.vendor="Kévin Dunglas"
|
|||||||
FROM common AS builder
|
FROM common AS builder
|
||||||
|
|
||||||
ARG FRANKENPHP_VERSION='dev'
|
ARG FRANKENPHP_VERSION='dev'
|
||||||
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||||
|
|
||||||
COPY --from=golang-base /usr/local/go /usr/local/go
|
COPY --from=golang-base /usr/local/go /usr/local/go
|
||||||
|
|
||||||
@@ -71,12 +72,11 @@ WORKDIR /go/src/app
|
|||||||
COPY --link go.mod go.sum ./
|
COPY --link go.mod go.sum ./
|
||||||
RUN go mod graph | awk '{if ($1 !~ "@") print $2}' | xargs go get
|
RUN go mod graph | awk '{if ($1 !~ "@") print $2}' | xargs go get
|
||||||
|
|
||||||
RUN mkdir caddy && cd caddy
|
WORKDIR /go/src/app/caddy
|
||||||
COPY --link caddy/go.mod caddy/go.sum ./caddy/
|
COPY --link caddy/go.mod caddy/go.sum ./
|
||||||
|
RUN go mod graph | awk '{if ($1 !~ "@") print $2}' | xargs go get
|
||||||
RUN cd caddy && \
|
|
||||||
go mod graph | awk '{if ($1 !~ "@") print $2}' | xargs go get
|
|
||||||
|
|
||||||
|
WORKDIR /go/src/app
|
||||||
COPY --link *.* ./
|
COPY --link *.* ./
|
||||||
COPY --link caddy caddy
|
COPY --link caddy caddy
|
||||||
COPY --link C-Thread-Pool C-Thread-Pool
|
COPY --link C-Thread-Pool C-Thread-Pool
|
||||||
@@ -87,12 +87,14 @@ COPY --link testdata testdata
|
|||||||
# see https://github.com/docker-library/php/blob/master/8.2/bookworm/zts/Dockerfile#L57-L59 for PHP values
|
# see https://github.com/docker-library/php/blob/master/8.2/bookworm/zts/Dockerfile#L57-L59 for PHP values
|
||||||
ENV CGO_LDFLAGS="-lssl -lcrypto -lreadline -largon2 -lcurl -lonig -lz $PHP_LDFLAGS" CGO_CFLAGS="-DFRANKENPHP_VERSION=$FRANKENPHP_VERSION $PHP_CFLAGS" CGO_CPPFLAGS=$PHP_CPPFLAGS
|
ENV CGO_LDFLAGS="-lssl -lcrypto -lreadline -largon2 -lcurl -lonig -lz $PHP_LDFLAGS" CGO_CFLAGS="-DFRANKENPHP_VERSION=$FRANKENPHP_VERSION $PHP_CFLAGS" CGO_CPPFLAGS=$PHP_CPPFLAGS
|
||||||
|
|
||||||
RUN cd caddy/frankenphp && \
|
WORKDIR /go/src/app/caddy/frankenphp
|
||||||
GOBIN=/usr/local/bin go install -ldflags "-X 'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP $FRANKENPHP_VERSION PHP $PHP_VERSION Caddy'" && \
|
RUN GOBIN=/usr/local/bin go install -ldflags "-X 'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP $FRANKENPHP_VERSION PHP $PHP_VERSION Caddy'" && \
|
||||||
setcap cap_net_bind_service=+ep /usr/local/bin/frankenphp && \
|
setcap cap_net_bind_service=+ep /usr/local/bin/frankenphp && \
|
||||||
cp Caddyfile /etc/caddy/Caddyfile && \
|
cp Caddyfile /etc/caddy/Caddyfile && \
|
||||||
frankenphp version
|
frankenphp version
|
||||||
|
|
||||||
|
WORKDIR /go/src/app
|
||||||
|
|
||||||
|
|
||||||
FROM common AS runner
|
FROM common AS runner
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ FrankenPHP is a modern application server for PHP built on top of the [Caddy](ht
|
|||||||
|
|
||||||
FrankenPHP gives superpowers to your PHP apps thanks to its stunning features: [*Early Hints*](docs/early-hints.md), [worker mode](docs/worker.md), [real-time capabilities](docs/mercure.md), automatic HTTPS, HTTP/2, and HTTP/3 support...
|
FrankenPHP gives superpowers to your PHP apps thanks to its stunning features: [*Early Hints*](docs/early-hints.md), [worker mode](docs/worker.md), [real-time capabilities](docs/mercure.md), automatic HTTPS, HTTP/2, and HTTP/3 support...
|
||||||
|
|
||||||
FrankenPHP works with any PHP app and makes your Symfony projects faster than ever thanks to provided integration with the worker mode (Laravel Octane support coming).
|
FrankenPHP works with any PHP app and makes your Symfony projects faster than ever thanks to the provided integration with the worker mode (Laravel Octane support coming).
|
||||||
|
|
||||||
FrankenPHP can also be used as a standalone Go library to embed PHP in any app using `net/http`.
|
FrankenPHP can also be used as a standalone Go library to embed PHP in any app using `net/http`.
|
||||||
|
|
||||||
|
|||||||
@@ -43,11 +43,13 @@ LABEL org.opencontainers.image.vendor="Kévin Dunglas"
|
|||||||
FROM common AS builder
|
FROM common AS builder
|
||||||
|
|
||||||
ARG FRANKENPHP_VERSION='dev'
|
ARG FRANKENPHP_VERSION='dev'
|
||||||
|
SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
|
||||||
|
|
||||||
COPY --link --from=golang-base /usr/local/go /usr/local/go
|
COPY --link --from=golang-base /usr/local/go /usr/local/go
|
||||||
|
|
||||||
ENV PATH /usr/local/go/bin:$PATH
|
ENV PATH /usr/local/go/bin:$PATH
|
||||||
|
|
||||||
|
# hadolint ignore=SC2086
|
||||||
RUN apk add --no-cache --virtual .build-deps \
|
RUN apk add --no-cache --virtual .build-deps \
|
||||||
$PHPIZE_DEPS \
|
$PHPIZE_DEPS \
|
||||||
argon2-dev \
|
argon2-dev \
|
||||||
@@ -67,11 +69,11 @@ WORKDIR /go/src/app
|
|||||||
COPY --link go.mod go.sum ./
|
COPY --link go.mod go.sum ./
|
||||||
RUN go mod graph | awk '{if ($1 !~ "@") print $2}' | xargs go get
|
RUN go mod graph | awk '{if ($1 !~ "@") print $2}' | xargs go get
|
||||||
|
|
||||||
RUN mkdir caddy && cd caddy
|
WORKDIR /go/src/app/caddy
|
||||||
COPY caddy/go.mod caddy/go.sum ./caddy/
|
COPY caddy/go.mod caddy/go.sum ./
|
||||||
|
RUN go mod graph | awk '{if ($1 !~ "@") print $2}' | xargs go get
|
||||||
RUN cd caddy && go mod graph | awk '{if ($1 !~ "@") print $2}' | xargs go get
|
|
||||||
|
|
||||||
|
WORKDIR /go/src/app
|
||||||
COPY --link *.* ./
|
COPY --link *.* ./
|
||||||
COPY --link caddy caddy
|
COPY --link caddy caddy
|
||||||
COPY --link C-Thread-Pool C-Thread-Pool
|
COPY --link C-Thread-Pool C-Thread-Pool
|
||||||
@@ -82,11 +84,13 @@ COPY --link testdata testdata
|
|||||||
# see https://github.com/docker-library/php/blob/master/8.2/bookworm/zts/Dockerfile#L57-L59 for php values
|
# see https://github.com/docker-library/php/blob/master/8.2/bookworm/zts/Dockerfile#L57-L59 for php values
|
||||||
ENV CGO_LDFLAGS="-lssl -lcrypto -lreadline -largon2 -lcurl -lonig -lz $PHP_LDFLAGS" CGO_CFLAGS="-DFRANKENPHP_VERSION=$FRANKENPHP_VERSION $PHP_CFLAGS" CGO_CPPFLAGS=$PHP_CPPFLAGS
|
ENV CGO_LDFLAGS="-lssl -lcrypto -lreadline -largon2 -lcurl -lonig -lz $PHP_LDFLAGS" CGO_CFLAGS="-DFRANKENPHP_VERSION=$FRANKENPHP_VERSION $PHP_CFLAGS" CGO_CPPFLAGS=$PHP_CPPFLAGS
|
||||||
|
|
||||||
RUN cd caddy/frankenphp && \
|
WORKDIR /go/src/app/caddy/frankenphp
|
||||||
GOBIN=/usr/local/bin go install -ldflags "-extldflags '-Wl,-z,stack-size=0x80000' -X 'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP $FRANKENPHP_VERSION PHP $PHP_VERSION Caddy'" && \
|
RUN GOBIN=/usr/local/bin go install -ldflags "-extldflags '-Wl,-z,stack-size=0x80000' -X 'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP $FRANKENPHP_VERSION PHP $PHP_VERSION Caddy'" && \
|
||||||
setcap cap_net_bind_service=+ep /usr/local/bin/frankenphp && \
|
setcap cap_net_bind_service=+ep /usr/local/bin/frankenphp && \
|
||||||
frankenphp version
|
frankenphp version
|
||||||
|
|
||||||
|
WORKDIR /go/src/app
|
||||||
|
|
||||||
|
|
||||||
FROM common AS runner
|
FROM common AS runner
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
set -o errexit
|
set -o errexit
|
||||||
trap 'echo "Aborting due to errexit on line $LINENO. Exit code: $?" >&2' ERR
|
|
||||||
set -o xtrace
|
set -o xtrace
|
||||||
|
|
||||||
if ! type "git" > /dev/null; then
|
if ! type "git" > /dev/null; then
|
||||||
@@ -38,7 +37,13 @@ if [ -z "$FRANKENPHP_VERSION" ]; then
|
|||||||
elif [ -d ".git/" ]; then
|
elif [ -d ".git/" ]; then
|
||||||
CURRENT_REF="$(git rev-parse --abbrev-ref HEAD)"
|
CURRENT_REF="$(git rev-parse --abbrev-ref HEAD)"
|
||||||
export CURRENT_REF
|
export CURRENT_REF
|
||||||
git checkout "v$FRANKENPHP_VERSION"
|
|
||||||
|
if echo "$FRANKENPHP_VERSION" | grep -F -q "."; then
|
||||||
|
# Tag
|
||||||
|
git checkout "v$FRANKENPHP_VERSION"
|
||||||
|
else
|
||||||
|
git checkout "$FRANKENPHP_VERSION"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
bin="frankenphp-$os-$arch"
|
bin="frankenphp-$os-$arch"
|
||||||
@@ -72,6 +77,7 @@ fi
|
|||||||
|
|
||||||
./bin/spc doctor
|
./bin/spc doctor
|
||||||
./bin/spc fetch --with-php="$PHP_VERSION" --for-extensions="$PHP_EXTENSIONS"
|
./bin/spc fetch --with-php="$PHP_VERSION" --for-extensions="$PHP_EXTENSIONS"
|
||||||
|
# shellcheck disable=SC2086
|
||||||
./bin/spc build --enable-zts --build-embed $extraOpts "$PHP_EXTENSIONS" --with-libs="$PHP_EXTENSION_LIBS"
|
./bin/spc build --enable-zts --build-embed $extraOpts "$PHP_EXTENSIONS" --with-libs="$PHP_EXTENSION_LIBS"
|
||||||
CGO_CFLAGS="-DFRANKENPHP_VERSION=$FRANKENPHP_VERSION $(./buildroot/bin/php-config --includes | sed s#-I/#-I"$PWD"/buildroot/#g)"
|
CGO_CFLAGS="-DFRANKENPHP_VERSION=$FRANKENPHP_VERSION $(./buildroot/bin/php-config --includes | sed s#-I/#-I"$PWD"/buildroot/#g)"
|
||||||
export CGO_CFLAGS
|
export CGO_CFLAGS
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ RUN apk add --no-cache \
|
|||||||
libtool && \
|
libtool && \
|
||||||
echo 'set auto-load safe-path /' > /root/.gdbinit
|
echo 'set auto-load safe-path /' > /root/.gdbinit
|
||||||
|
|
||||||
RUN git clone --branch=PHP-8.3 https://github.com/php/php-src.git && \
|
WORKDIR /usr/local/src/php
|
||||||
cd php-src && \
|
RUN git clone --branch=PHP-8.3 https://github.com/php/php-src.git . && \
|
||||||
# --enable-embed is only necessary to generate libphp.so, we don't use this SAPI directly
|
# --enable-embed is only necessary to generate libphp.so, we don't use this SAPI directly
|
||||||
./buildconf --force && \
|
./buildconf --force && \
|
||||||
./configure \
|
./configure \
|
||||||
@@ -47,18 +47,19 @@ RUN git clone --branch=PHP-8.3 https://github.com/php/php-src.git && \
|
|||||||
--disable-zend-signals \
|
--disable-zend-signals \
|
||||||
--enable-zend-max-execution-timers \
|
--enable-zend-max-execution-timers \
|
||||||
--enable-debug && \
|
--enable-debug && \
|
||||||
make -j$(nproc) && \
|
make -j"$(nproc)" && \
|
||||||
make install && \
|
make install && \
|
||||||
ldconfig /etc/ld.so.conf.d && \
|
ldconfig /etc/ld.so.conf.d && \
|
||||||
cp php.ini-development /usr/local/lib/php.ini && \
|
cp php.ini-development /usr/local/lib/php.ini && \
|
||||||
echo -e "zend_extension=opcache.so\nopcache.enable=1" >> /usr/local/lib/php.ini &&\
|
echo "zend_extension=opcache.so" >> /usr/local/lib/php.ini && \
|
||||||
|
echo "opcache.enable=1" >> /usr/local/lib/php.ini && \
|
||||||
php --version
|
php --version
|
||||||
|
|
||||||
WORKDIR /go/src/app
|
WORKDIR /go/src/app
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN cd caddy/frankenphp && \
|
WORKDIR /go/src/app/caddy/frankenphp
|
||||||
go build
|
RUN go build
|
||||||
|
|
||||||
|
WORKDIR /go/src/app
|
||||||
CMD [ "zsh" ]
|
CMD [ "zsh" ]
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ ENV PHPIZE_DEPS \
|
|||||||
pkg-config \
|
pkg-config \
|
||||||
re2c
|
re2c
|
||||||
|
|
||||||
|
# hadolint ignore=DL3009
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get -y --no-install-recommends install \
|
apt-get -y --no-install-recommends install \
|
||||||
$PHPIZE_DEPS \
|
$PHPIZE_DEPS \
|
||||||
@@ -41,8 +42,8 @@ RUN apt-get update && \
|
|||||||
&& \
|
&& \
|
||||||
apt-get clean
|
apt-get clean
|
||||||
|
|
||||||
RUN git clone --branch=PHP-8.3 https://github.com/php/php-src.git && \
|
WORKDIR /usr/local/src/php
|
||||||
cd php-src && \
|
RUN git clone --branch=PHP-8.3 https://github.com/php/php-src.git . && \
|
||||||
# --enable-embed is only necessary to generate libphp.so, we don't use this SAPI directly
|
# --enable-embed is only necessary to generate libphp.so, we don't use this SAPI directly
|
||||||
./buildconf --force && \
|
./buildconf --force && \
|
||||||
./configure \
|
./configure \
|
||||||
@@ -51,18 +52,19 @@ RUN git clone --branch=PHP-8.3 https://github.com/php/php-src.git && \
|
|||||||
--disable-zend-signals \
|
--disable-zend-signals \
|
||||||
--enable-zend-max-execution-timers \
|
--enable-zend-max-execution-timers \
|
||||||
--enable-debug && \
|
--enable-debug && \
|
||||||
make -j$(nproc) && \
|
make -j"$(nproc)" && \
|
||||||
make install && \
|
make install && \
|
||||||
ldconfig && \
|
ldconfig && \
|
||||||
cp php.ini-development /usr/local/lib/php.ini && \
|
cp php.ini-development /usr/local/lib/php.ini && \
|
||||||
echo "zend_extension=opcache.so\nopcache.enable=1" >> /usr/local/lib/php.ini &&\
|
echo "zend_extension=opcache.so" >> /usr/local/lib/php.ini && \
|
||||||
|
echo "opcache.enable=1" >> /usr/local/lib/php.ini && \
|
||||||
php --version
|
php --version
|
||||||
|
|
||||||
WORKDIR /go/src/app
|
WORKDIR /go/src/app
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN cd caddy/frankenphp && \
|
WORKDIR /go/src/app/caddy/frankenphp
|
||||||
go build
|
RUN go build
|
||||||
|
|
||||||
|
WORKDIR /go/src/app
|
||||||
CMD [ "zsh" ]
|
CMD [ "zsh" ]
|
||||||
|
|||||||
@@ -89,4 +89,4 @@ CGO_ENABLED=1 xcaddy build \
|
|||||||
--with github.com/dunglas/mercure/caddy \
|
--with github.com/dunglas/mercure/caddy \
|
||||||
--with github.com/dunglas/vulcain/caddy
|
--with github.com/dunglas/vulcain/caddy
|
||||||
# Add extra Caddy modules here
|
# Add extra Caddy modules here
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ COPY . /app/public
|
|||||||
Then, run the commands to build and run the Docker image:
|
Then, run the commands to build and run the Docker image:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker build -t my-php-app .
|
docker build -t my-php-app .
|
||||||
$ docker run -it --rm --name my-running-app my-php-app
|
docker run -it --rm --name my-running-app my-php-app
|
||||||
```
|
```
|
||||||
|
|
||||||
## How to Install More PHP Extensions
|
## How to Install More PHP Extensions
|
||||||
@@ -70,7 +70,7 @@ COPY --from=builder /usr/local/bin/frankenphp /usr/local/bin/frankenphp
|
|||||||
The `builder` image provided by FrankenPHP contains a compiled version of libphp.
|
The `builder` image provided by FrankenPHP contains a compiled version of libphp.
|
||||||
[Builders images](https://hub.docker.com/r/dunglas/frankenphp/tags?name=builder) are provided for all versions of FrankenPHP and PHP, both for Alpine and Debian.
|
[Builders images](https://hub.docker.com/r/dunglas/frankenphp/tags?name=builder) are provided for all versions of FrankenPHP and PHP, both for Alpine and Debian.
|
||||||
|
|
||||||
# Enabling the Worker Mode by Default
|
## Enabling the Worker Mode by Default
|
||||||
|
|
||||||
Set the `FRANKENPHP_CONFIG` environment variable to start FrankenPHP with a worker script:
|
Set the `FRANKENPHP_CONFIG` environment variable to start FrankenPHP with a worker script:
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ FROM dunglas/frankenphp
|
|||||||
ENV FRANKENPHP_CONFIG="worker ./public/index.php"
|
ENV FRANKENPHP_CONFIG="worker ./public/index.php"
|
||||||
```
|
```
|
||||||
|
|
||||||
# Using a Volume in Development
|
## Using a Volume in Development
|
||||||
|
|
||||||
To develop easily with FrankenPHP, mount the directory from your host containing the source code of the app as a volume in the Docker container:
|
To develop easily with FrankenPHP, mount the directory from your host containing the source code of the app as a volume in the Docker container:
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ Calling PHP functions and language constructs that themselves call [cgo](https:/
|
|||||||
|
|
||||||
This issue [is being worked on by the Go project](https://github.com/golang/go/issues/62130).
|
This issue [is being worked on by the Go project](https://github.com/golang/go/issues/62130).
|
||||||
|
|
||||||
|
|
||||||
In the meantime, one solution is not to use constructs (like `echo`) and functions (like `header()`) that delegate to Go from inside Fibers.
|
In the meantime, one solution is not to use constructs (like `echo`) and functions (like `header()`) that delegate to Go from inside Fibers.
|
||||||
|
|
||||||
This code will likely crash because it uses `echo` in the Fiber:
|
This code will likely crash because it uses `echo` in the Fiber:
|
||||||
|
|||||||
@@ -18,20 +18,22 @@ Alternatively, you can run your Laravel projects with FrankenPHP from your local
|
|||||||
|
|
||||||
1. [Download the binary corresponding to your system](https://github.com/dunglas/frankenphp/releases)
|
1. [Download the binary corresponding to your system](https://github.com/dunglas/frankenphp/releases)
|
||||||
2. Add the following configuration to a file named `Caddyfile` in the root directory of your Laravel project:
|
2. Add the following configuration to a file named `Caddyfile` in the root directory of your Laravel project:
|
||||||
```caddyfile
|
|
||||||
{
|
|
||||||
frankenphp
|
|
||||||
order php_server before file_server
|
|
||||||
}
|
|
||||||
|
|
||||||
# The domain name of your server
|
```caddyfile
|
||||||
localhost {
|
{
|
||||||
# Enable compression (optional)
|
frankenphp
|
||||||
encode zstd gzip
|
order php_server before file_server
|
||||||
# Execute PHP files in the current directory and serve assets
|
}
|
||||||
php_server
|
|
||||||
}
|
# The domain name of your server
|
||||||
```
|
localhost {
|
||||||
|
# Enable compression (optional)
|
||||||
|
encode zstd gzip
|
||||||
|
# Execute PHP files in the current directory and serve assets
|
||||||
|
php_server
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
3. Start FrankenPHP from the root directory of your Laravel project: `./frankenphp run`
|
3. Start FrankenPHP from the root directory of your Laravel project: `./frankenphp run`
|
||||||
|
|
||||||
## Laravel Octane
|
## Laravel Octane
|
||||||
|
|||||||
@@ -7,6 +7,6 @@ No JS library or SDK required!
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
To enable the Mercure hub, update the `Caddyfile` as described [on Mercure's website](https://mercure.rocks/docs/hub/config).
|
To enable the Mercure hub, update the `Caddyfile` as described [on Mercure's site](https://mercure.rocks/docs/hub/config).
|
||||||
|
|
||||||
To push Mercure updates from your code, we recommend the [Symfony Mercure Component](https://symfony.com/components/Mercure) (you don't need the Symfony full stack framework to use it).
|
To push Mercure updates from your code, we recommend the [Symfony Mercure Component](https://symfony.com/components/Mercure) (you don't need the Symfony full stack framework to use it).
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ do {
|
|||||||
$myApp->shutdown();
|
$myApp->shutdown();
|
||||||
```
|
```
|
||||||
|
|
||||||
Then, start your app and use the `FRANKENPHP_CONFIG` environment variable to configure your worker:
|
Then, start your app and use the `FRANKENPHP_CONFIG` environment variable to configure your worker:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
docker run \
|
docker run \
|
||||||
|
|||||||
1212
frankenphp.c
1212
frankenphp.c
File diff suppressed because it is too large
Load Diff
45
frankenphp.h
45
frankenphp.h
@@ -1,9 +1,9 @@
|
|||||||
#ifndef _FRANKENPPHP_H
|
#ifndef _FRANKENPPHP_H
|
||||||
#define _FRANKENPPHP_H
|
#define _FRANKENPPHP_H
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <Zend/zend_types.h>
|
#include <Zend/zend_types.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#ifndef FRANKENPHP_VERSION
|
#ifndef FRANKENPHP_VERSION
|
||||||
#define FRANKENPHP_VERSION dev
|
#define FRANKENPHP_VERSION dev
|
||||||
@@ -12,43 +12,36 @@
|
|||||||
#define TOSTRING(x) STRINGIFY(x)
|
#define TOSTRING(x) STRINGIFY(x)
|
||||||
|
|
||||||
typedef struct frankenphp_version {
|
typedef struct frankenphp_version {
|
||||||
unsigned char major_version;
|
unsigned char major_version;
|
||||||
unsigned char minor_version;
|
unsigned char minor_version;
|
||||||
unsigned char release_version;
|
unsigned char release_version;
|
||||||
const char *extra_version;
|
const char *extra_version;
|
||||||
const char *version;
|
const char *version;
|
||||||
unsigned long version_id;
|
unsigned long version_id;
|
||||||
} frankenphp_version;
|
} frankenphp_version;
|
||||||
frankenphp_version frankenphp_get_version();
|
frankenphp_version frankenphp_get_version();
|
||||||
|
|
||||||
typedef struct frankenphp_config {
|
typedef struct frankenphp_config {
|
||||||
frankenphp_version version;
|
frankenphp_version version;
|
||||||
bool zts;
|
bool zts;
|
||||||
bool zend_signals;
|
bool zend_signals;
|
||||||
bool zend_max_execution_timers;
|
bool zend_max_execution_timers;
|
||||||
} frankenphp_config;
|
} frankenphp_config;
|
||||||
frankenphp_config frankenphp_get_config();
|
frankenphp_config frankenphp_get_config();
|
||||||
|
|
||||||
int frankenphp_init(int num_threads);
|
int frankenphp_init(int num_threads);
|
||||||
|
|
||||||
int frankenphp_update_server_context(
|
int frankenphp_update_server_context(
|
||||||
bool create,
|
bool create, uintptr_t current_request, uintptr_t main_request,
|
||||||
uintptr_t current_request,
|
|
||||||
uintptr_t main_request,
|
|
||||||
|
|
||||||
const char *request_method,
|
const char *request_method, char *query_string, zend_long content_length,
|
||||||
char *query_string,
|
char *path_translated, char *request_uri, const char *content_type,
|
||||||
zend_long content_length,
|
char *auth_user, char *auth_password, int proto_num);
|
||||||
char *path_translated,
|
|
||||||
char *request_uri,
|
|
||||||
const char *content_type,
|
|
||||||
char *auth_user,
|
|
||||||
char *auth_password,
|
|
||||||
int proto_num
|
|
||||||
);
|
|
||||||
int frankenphp_request_startup();
|
int frankenphp_request_startup();
|
||||||
int frankenphp_execute_script(char *file_name);
|
int frankenphp_execute_script(char *file_name);
|
||||||
void frankenphp_register_bulk_variables(char *known_variables[27], char **dynamic_variables, size_t size, zval *track_vars_array);
|
void frankenphp_register_bulk_variables(char *known_variables[27],
|
||||||
|
char **dynamic_variables, size_t size,
|
||||||
|
zval *track_vars_array);
|
||||||
|
|
||||||
int frankenphp_execute_script_cli(char *script, int argc, char **argv);
|
int frankenphp_execute_script_cli(char *script, int argc, char **argv);
|
||||||
|
|
||||||
|
|||||||
@@ -1,29 +1,28 @@
|
|||||||
/* This is a generated file, edit the .stub.php file instead.
|
/* This is a generated file, edit the .stub.php file instead.
|
||||||
* Stub hash: de4dc4063fafd8c933e3068c8349889a7ece5f03 */
|
* Stub hash: de4dc4063fafd8c933e3068c8349889a7ece5f03 */
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_frankenphp_handle_request, 0, 1, _IS_BOOL, 0)
|
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_frankenphp_handle_request, 0, 1,
|
||||||
ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 0)
|
_IS_BOOL, 0)
|
||||||
|
ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 0)
|
||||||
ZEND_END_ARG_INFO()
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_headers_send, 0, 0, IS_LONG, 0)
|
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_headers_send, 0, 0, IS_LONG, 0)
|
||||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, status, IS_LONG, 0, "200")
|
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, status, IS_LONG, 0, "200")
|
||||||
ZEND_END_ARG_INFO()
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_frankenphp_finish_request, 0, 0, _IS_BOOL, 0)
|
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_frankenphp_finish_request, 0, 0,
|
||||||
|
_IS_BOOL, 0)
|
||||||
ZEND_END_ARG_INFO()
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
#define arginfo_fastcgi_finish_request arginfo_frankenphp_finish_request
|
#define arginfo_fastcgi_finish_request arginfo_frankenphp_finish_request
|
||||||
|
|
||||||
|
|
||||||
ZEND_FUNCTION(frankenphp_handle_request);
|
ZEND_FUNCTION(frankenphp_handle_request);
|
||||||
ZEND_FUNCTION(headers_send);
|
ZEND_FUNCTION(headers_send);
|
||||||
ZEND_FUNCTION(frankenphp_finish_request);
|
ZEND_FUNCTION(frankenphp_finish_request);
|
||||||
|
|
||||||
|
|
||||||
static const zend_function_entry ext_functions[] = {
|
static const zend_function_entry ext_functions[] = {
|
||||||
ZEND_FE(frankenphp_handle_request, arginfo_frankenphp_handle_request)
|
ZEND_FE(frankenphp_handle_request, arginfo_frankenphp_handle_request)
|
||||||
ZEND_FE(headers_send, arginfo_headers_send)
|
ZEND_FE(headers_send, arginfo_headers_send) ZEND_FE(
|
||||||
ZEND_FE(frankenphp_finish_request, arginfo_frankenphp_finish_request)
|
frankenphp_finish_request, arginfo_frankenphp_finish_request)
|
||||||
ZEND_FALIAS(fastcgi_finish_request, frankenphp_finish_request, arginfo_fastcgi_finish_request)
|
ZEND_FALIAS(fastcgi_finish_request, frankenphp_finish_request,
|
||||||
ZEND_FE_END
|
arginfo_fastcgi_finish_request) ZEND_FE_END};
|
||||||
};
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ ARG FRANKENPHP_VERSION=''
|
|||||||
ARG PHP_VERSION=''
|
ARG PHP_VERSION=''
|
||||||
ARG PHP_EXTENSIONS=''
|
ARG PHP_EXTENSIONS=''
|
||||||
ARG PHP_EXTENSION_LIBS=''
|
ARG PHP_EXTENSION_LIBS=''
|
||||||
|
SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
|
||||||
|
|
||||||
RUN apk update; \
|
RUN apk update; \
|
||||||
apk add --no-cache \
|
apk add --no-cache \
|
||||||
@@ -56,15 +57,14 @@ ENV PATH="${PATH}:/root/.composer/vendor/bin"
|
|||||||
COPY --from=composer/composer:2-bin --link /composer /usr/bin/composer
|
COPY --from=composer/composer:2-bin --link /composer /usr/bin/composer
|
||||||
|
|
||||||
WORKDIR /go/src/app
|
WORKDIR /go/src/app
|
||||||
|
|
||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
RUN go mod graph | awk '{if ($1 !~ "@") print $2}' | xargs go get
|
RUN go mod graph | awk '{if ($1 !~ "@") print $2}' | xargs go get
|
||||||
|
|
||||||
RUN mkdir caddy && cd caddy
|
WORKDIR /go/src/app/caddy
|
||||||
COPY caddy/go.mod caddy/go.sum ./caddy/
|
COPY caddy/go.mod caddy/go.sum ./
|
||||||
|
RUN go mod graph | awk '{if ($1 !~ "@") print $2}' | xargs go get
|
||||||
RUN cd caddy && go mod graph | awk '{if ($1 !~ "@") print $2}' | xargs go get
|
|
||||||
|
|
||||||
|
WORKDIR /go/src/app
|
||||||
COPY *.* ./
|
COPY *.* ./
|
||||||
COPY caddy caddy
|
COPY caddy caddy
|
||||||
COPY C-Thread-Pool C-Thread-Pool
|
COPY C-Thread-Pool C-Thread-Pool
|
||||||
|
|||||||
Reference in New Issue
Block a user