Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ jobs:
runner-${{ matrix.variant }}
# Remove tags to prevent "can't push tagged ref [...] by digest" error
set: |
${{ (github.event_name == 'pull_request') && '*.args.NO_COMPRESS=1' || '' }}
*.tags=
*.platform=${{ matrix.platform }}
Comment thread
dunglas marked this conversation as resolved.
${{ fromJson(needs.prepare.outputs.push) && '' || format('builder-{0}.cache-from=type=gha,scope=builder-{0}-{1}-{2}', matrix.variant, needs.prepare.outputs.ref || github.ref, matrix.platform) }}
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/static.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ jobs:
set: |
${{ matrix.debug && 'static-builder-musl.args.DEBUG_SYMBOLS=1' || '' }}
${{ matrix.mimalloc && 'static-builder-musl.args.MIMALLOC=1' || '' }}
${{ (github.event_name == 'pull_request' || matrix.platform == 'linux/arm64') && 'static-builder-musl.args.NO_COMPRESS=1' || '' }}
*.tags=
*.platform=${{ matrix.platform }}
${{ fromJson(needs.prepare.outputs.push) && '' || format('*.cache-from=type=gha,scope={0}-static-builder-musl{1}{2}', needs.prepare.outputs.ref || github.ref, matrix.debug && '-debug' || '', matrix.mimalloc && '-mimalloc' || '') }}
Expand Down Expand Up @@ -302,7 +301,6 @@ jobs:
source: .
targets: static-builder-gnu
set: |
${{ (github.event_name == 'pull_request' || matrix.platform == 'linux/arm64') && 'static-builder-gnu.args.NO_COMPRESS=1' || '' }}
*.tags=
*.platform=${{ matrix.platform }}
${{ fromJson(needs.prepare.outputs.push) && '' || format('*.cache-from=type=gha,scope={0}-static-builder-gnu', needs.prepare.outputs.ref || github.ref) }}
Expand Down Expand Up @@ -466,7 +464,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FRANKENPHP_VERSION: ${{ steps.version.outputs.version }}
RELEASE: ${{ (needs.prepare.outputs.ref || github.ref_type == 'tag') && '1' || '' }}
NO_COMPRESS: ${{ github.event_name == 'pull_request' && '1' || '' }}
- name: Upload logs
if: ${{ failure() }}
uses: actions/upload-artifact@v7
Expand Down
4 changes: 2 additions & 2 deletions alpine.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ LABEL org.opencontainers.image.vendor="Kévin Dunglas"
FROM common AS builder

ARG FRANKENPHP_VERSION='dev'
ARG NO_COMPRESS=''
ARG COMPRESS=''
SHELL ["/bin/ash", "-eo", "pipefail", "-c"]

COPY --link --from=golang-base /usr/local/go /usr/local/go
Expand Down Expand Up @@ -125,7 +125,7 @@ WORKDIR /go/src/app/caddy/frankenphp
RUN GOBIN=/usr/local/bin \
../../go.sh install -ldflags "-w -s -extldflags '-Wl,-z,stack-size=0x80000' -X 'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP $FRANKENPHP_VERSION PHP $PHP_VERSION Caddy' -X 'github.com/caddyserver/caddy/v2.CustomBinaryName=frankenphp' -X 'github.com/caddyserver/caddy/v2/modules/caddyhttp.ServerHeader=FrankenPHP Caddy'" -buildvcs=true && \
setcap cap_net_bind_service=+ep /usr/local/bin/frankenphp && \
([ -z "${NO_COMPRESS}" ] && upx --best /usr/local/bin/frankenphp || true) && \
([ -n "${COMPRESS}" ] && upx --best /usr/local/bin/frankenphp || true) && \
Comment thread
dunglas marked this conversation as resolved.
frankenphp version && \
frankenphp build-info

Expand Down
3 changes: 2 additions & 1 deletion build-static.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ os="$(uname -s | tr '[:upper:]' '[:lower:]')"
# - FRANKENPHP_VERSION: FrankenPHP version (default: current Git commit)
# - EMBED: Path to the PHP app to embed (default: none)
# - DEBUG_SYMBOLS: Enable debug symbols if set to 1 (default: none)
# - COMPRESS: Pack the resulting Linux binary with UPX if set to 1; ignored when DEBUG_SYMBOLS is set (default: none)
# - MIMALLOC: Use mimalloc as the allocator if set to 1 (default: none)
# - XCADDY_ARGS: Additional arguments to pass to xcaddy
# - RELEASE: [maintainer only] Create a GitHub release if set to 1 (default: none)
Expand Down Expand Up @@ -189,7 +190,7 @@ if [ -n "${EMBED}" ] && [ -d "${EMBED}" ]; then
fi

SPC_OPT_INSTALL_ARGS="go-xcaddy"
if [ -z "${DEBUG_SYMBOLS}" ] && [ -z "${NO_COMPRESS}" ] && [ "${os}" = "linux" ]; then
if [ -n "${COMPRESS}" ] && [ -z "${DEBUG_SYMBOLS}" ] && [ "${os}" = "linux" ]; then
Comment thread
dunglas marked this conversation as resolved.
SPC_OPT_BUILD_ARGS="${SPC_OPT_BUILD_ARGS} --with-upx-pack"
SPC_OPT_INSTALL_ARGS="${SPC_OPT_INSTALL_ARGS} upx"
fi
Comment thread
dunglas marked this conversation as resolved.
Expand Down
5 changes: 5 additions & 0 deletions caddy/hotreload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"strings"
"sync"
"testing"
"time"

"github.com/caddyserver/caddy/v2/caddytest"
"github.com/stretchr/testify/require"
Expand All @@ -25,6 +26,10 @@ func TestHotReload(t *testing.T) {
indexFile := filepath.Join(tmpDir, "index.php")

tester := caddytest.NewTester(t)
// caddytest's default 5s http.Client.Timeout is too tight for the
// SSE roundtrip below on slow CI runners (notably emulated armv7).
// 30s keeps the test bounded so a real regression fails fast.
tester.Client.Timeout = 30 * time.Second
tester.InitServer(`
{
debug
Expand Down
2 changes: 1 addition & 1 deletion docs/cn/embed.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ EMBED=/path/to/your/app ./build-static.sh

## 分发二进制文件

在Linux上,创建的二进制文件使用[UPX](https://upx.github.io)进行压缩
在 Linux 上,可以通过在构建时设置环境变量 `COMPRESS=1` 来使用 [UPX](https://upx.github.io) 压缩生成的二进制文件

在Mac上,您可以在发送文件之前压缩它以减小文件大小。
我们推荐使用 `xz`。
2 changes: 1 addition & 1 deletion docs/cn/static.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ cd frankenphp
- `XCADDY_ARGS`:传递给 [xcaddy](https://github.com/caddyserver/xcaddy) 的参数,例如用于添加额外的 Caddy 模块
- `EMBED`: 要嵌入二进制文件的 PHP 应用程序的路径
- `CLEAN`: 设置后,libphp 及其所有依赖项都是重新构建的(不使用缓存)
- `NO_COMPRESS`: 不要使用UPX压缩生成的二进制文件
- `COMPRESS`: 设置为 `1` 时使用 UPX 压缩生成的二进制文件(仅限 Linux;设置了 `DEBUG_SYMBOLS` 时忽略此选项)
- `DEBUG_SYMBOLS`: 设置后,调试符号将被保留在二进制文件内
- `MIMALLOC`: (实验性,仅限Linux) 用[mimalloc](https://github.com/microsoft/mimalloc)替换musl的mallocng,以提高性能。我们仅建议在musl目标构建中使用此选项,对于glibc,建议禁用此选项,并在运行二进制文件时使用[`LD_PRELOAD`](https://microsoft.github.io/mimalloc/overrides.html)。
- `RELEASE`: (仅限维护者)设置后,生成的二进制文件将上传到 GitHub 上
Expand Down
2 changes: 1 addition & 1 deletion docs/embed.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ To customize the extensions, use the `PHP_EXTENSIONS` environment variable.

## Distributing the binary

On Linux, the created binary is compressed using [UPX](https://upx.github.io).
On Linux, the created binary can be compressed using [UPX](https://upx.github.io) by setting the `COMPRESS=1` environment variable at build time.

On macOS, to reduce the size of the file before sending it, you can compress it.
We recommend `xz`.
2 changes: 1 addition & 1 deletion docs/es/embed.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Para personalizar las extensiones, use la variable de entorno `PHP_EXTENSIONS`.

## Distribuir el binario

En Linux, el binario creado se comprime usando [UPX](https://upx.github.io).
En Linux, el binario creado puede comprimirse usando [UPX](https://upx.github.io) estableciendo la variable de entorno `COMPRESS=1` en el momento de la compilación.

En Mac, para reducir el tamaño del archivo antes de enviarlo, puede comprimirlo.
Recomendamos `xz`.
2 changes: 1 addition & 1 deletion docs/es/static.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ Las siguientes variables de entorno pueden pasarse a `docker build` y al script
- `XCADDY_ARGS`: argumentos a pasar a [xcaddy](https://github.com/caddyserver/xcaddy), por ejemplo para agregar módulos adicionales de Caddy
- `EMBED`: ruta de la aplicación PHP a incrustar en el binario
- `CLEAN`: cuando está establecido, libphp y todas sus dependencias se compilan desde cero (sin caché)
- `NO_COMPRESS`: no comprimir el binario resultante usando UPX
- `COMPRESS`: cuando se establece en `1`, comprime el binario resultante usando UPX (solo Linux; se ignora cuando `DEBUG_SYMBOLS` está establecido)
- `DEBUG_SYMBOLS`: cuando está establecido, los símbolos de depuración no se eliminarán y se añadirán al binario
- `MIMALLOC`: (experimental, solo Linux) reemplaza mallocng de musl por [mimalloc](https://github.com/microsoft/mimalloc) para mejorar el rendimiento. Solo recomendamos usar esto para compilaciones orientadas a musl; para glibc, preferimos deshabilitar esta opción y usar [`LD_PRELOAD`](https://microsoft.github.io/mimalloc/overrides.html) cuando ejecutes tu binario.
- `RELEASE`: (solo para mantenedores) cuando está establecido, el binario resultante se subirá a GitHub
Expand Down
2 changes: 1 addition & 1 deletion docs/fr/embed.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ PHP_EXTENSIONS=ctype,iconv,pdo_sqlite \

## Distribuer le binaire

Sous Linux, le binaire est compressé par défaut à l'aide de [UPX](https://upx.github.io).
Sous Linux, le binaire peut être compressé à l'aide de [UPX](https://upx.github.io) en définissant la variable d'environnement `COMPRESS=1` au moment de la compilation.

Sous Mac, pour réduire la taille du fichier avant de l'envoyer, vous pouvez le compresser.
Nous recommandons `xz`.
2 changes: 1 addition & 1 deletion docs/fr/static.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Les variables d'environnement suivantes peuvent être transmises à `docker buil
- `EMBED` : chemin de l'application PHP à intégrer dans le binaire
- `CLEAN` : lorsque défini, `libphp` et toutes ses dépendances sont construites à partir de zéro (pas de cache)
- `DEBUG_SYMBOLS` : lorsque défini, les symboles de débogage ne seront pas supprimés et seront ajoutés dans le binaire
- `NO_COMPRESS` : ne pas compresser le binaire avec UPX
- `COMPRESS` : lorsque défini à `1`, compresse le binaire résultant avec UPX (Linux uniquement ; ignoré lorsque `DEBUG_SYMBOLS` est défini)
- `MIMALLOC` : (expérimental, Linux seulement) remplace l'allocateur mallocng de musl par [mimalloc](https://github.com/microsoft/mimalloc) pour des performances améliorées
- `RELEASE` : (uniquement pour les mainteneurs) lorsque défini, le binaire résultant sera uploadé sur GitHub

Expand Down
2 changes: 1 addition & 1 deletion docs/ja/embed.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ HTTPS(Let's Encrypt証明書は自動作成)、HTTP/2、HTTP/3を有効に

## バイナリの配布

Linuxでは、作成されたバイナリは[UPX](https://upx.github.io)を使用して圧縮されます
Linux では、ビルド時に環境変数 `COMPRESS=1` を設定することで、作成されたバイナリを [UPX](https://upx.github.io) で圧縮できます

Macでは、送信前にファイルサイズを減らすために圧縮できます。
`xz`の使用をお勧めします。
2 changes: 1 addition & 1 deletion docs/ja/static.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ cd frankenphp
- `XCADDY_ARGS`: 追加のCaddyモジュールを導入するなど[xcaddy](https://github.com/caddyserver/xcaddy)に渡す引数
- `EMBED`: バイナリに埋め込むPHPアプリケーションのパス
- `CLEAN`: 指定するとlibphpおよびそのすべての依存関係がスクラッチからビルドされます(キャッシュなし)
- `NO_COMPRESS`: UPXを使用して結果のバイナリを圧縮しない
- `COMPRESS`: `1` に設定すると UPX を使用して結果のバイナリを圧縮します(Linux のみ。`DEBUG_SYMBOLS` が設定されている場合は無視されます)
- `DEBUG_SYMBOLS`: 指定すると、デバッグシンボルが除去されず、バイナリに含まれます
- `MIMALLOC`: (実験的、Linuxのみ)パフォーマンス向上のためにmuslのmallocngを[mimalloc](https://github.com/microsoft/mimalloc)に置き換えます。muslをターゲットとするビルドにのみこれを使用することをお勧めします。glibcの場合は、このオプションを無効にして、代わりにバイナリを実行する際に[`LD_PRELOAD`](https://microsoft.github.io/mimalloc/overrides.html)を使用することをお勧めします。
- `RELEASE`: (メンテナー用)指定すると、生成されたバイナリがGitHubにアップロードされます
Expand Down
2 changes: 1 addition & 1 deletion docs/pt-br/embed.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ personalizar o binário (extensões, versão do PHP...).

## Distribuindo o binário

No Linux, o binário criado é compactado usando [UPX](https://upx.github.io).
No Linux, o binário criado pode ser compactado usando [UPX](https://upx.github.io) definindo a variável de ambiente `COMPRESS=1` no momento da compilação.

No Mac, para reduzir o tamanho do arquivo antes de enviá-lo, você pode
compactá-lo.
Expand Down
2 changes: 1 addition & 1 deletion docs/pt-br/static.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ o script `build-static.sh` para personalizar a compilação estática:
- `EMBED`: caminho da aplicação PHP a ser incorporada no binário;
- `CLEAN`: quando definida, a `libphp` e todas as suas dependências são
compiladas do zero (sem cache);
- `NO_COMPRESS`: não compacta o binário resultante usando UPX;
- `COMPRESS`: quando definida como `1`, compacta o binário resultante usando UPX (apenas Linux; ignorada quando `DEBUG_SYMBOLS` está definida);
- `DEBUG_SYMBOLS`: quando definida, os símbolos de depuração não serão removidos
e serão adicionados ao binário;
- `MIMALLOC`: (experimental, somente Linux) substitui `mallocng` da `musl` por
Expand Down
2 changes: 1 addition & 1 deletion docs/ru/embed.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,6 @@ EMBED=/path/to/your/app ./build-static.sh

## Распространение бинарного файла

На Linux созданный бинарный файл сжимается с помощью [UPX](https://upx.github.io).
На Linux созданный бинарный файл можно сжать с помощью [UPX](https://upx.github.io), задав переменную окружения `COMPRESS=1` во время сборки.

На Mac для уменьшения размера файла перед отправкой его можно сжать. Рекомендуется использовать `xz`.
2 changes: 1 addition & 1 deletion docs/ru/static.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ cd frankenphp
- `XCADDY_ARGS`: аргументы для [xcaddy](https://github.com/caddyserver/xcaddy), например, для добавления модулей Caddy
- `EMBED`: путь к PHP-приложению для встраивания в бинарник
- `CLEAN`: если задано, libphp и все его зависимости будут пересобраны с нуля (без кэша)
- `NO_COMPRESS`: отключает сжатие результирующего бинарника с помощью UPX
- `COMPRESS`: если установлено в `1`, сжимает результирующий бинарник с помощью UPX (только для Linux; игнорируется, если задан `DEBUG_SYMBOLS`)
- `DEBUG_SYMBOLS`: если задано, отладочные символы не будут удалены и будут добавлены в бинарник
- `MIMALLOC`: (экспериментально, только для Linux) заменяет musl's mallocng на [mimalloc](https://github.com/microsoft/mimalloc) для повышения производительности
- `RELEASE`: (только для мейнтейнеров) если задано, бинарник будет загружен на GitHub
2 changes: 1 addition & 1 deletion docs/static.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ script to customize the static build:
- `XCADDY_ARGS`: arguments to pass to [xcaddy](https://github.com/caddyserver/xcaddy), for instance to add extra Caddy modules
- `EMBED`: path of the PHP application to embed in the binary
- `CLEAN`: when set, libphp and all its dependencies are built from scratch (no cache)
- `NO_COMPRESS`: don't compress the resulting binary using UPX
- `COMPRESS`: when set to `1`, pack the resulting binary with UPX (Linux only; ignored when `DEBUG_SYMBOLS` is set)
- `DEBUG_SYMBOLS`: when set, debug-symbols will not be stripped and will be added to the binary
- `MIMALLOC`: (experimental, Linux-only) replace musl's mallocng by [mimalloc](https://github.com/microsoft/mimalloc) for improved performance. We only recommend using this for musl targeting builds, for glibc prefer disabling this option and using [`LD_PRELOAD`](https://microsoft.github.io/mimalloc/overrides.html) when you run your binary instead.
- `RELEASE`: (maintainers only) when set, the resulting binary will be uploaded on GitHub
Expand Down
2 changes: 1 addition & 1 deletion docs/tr/embed.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Binary dosyasının nasıl özelleştirileceğini (uzantılar, PHP sürümü...)

## Binary Dosyasının Dağıtılması

Linux'ta, oluşturulan ikili dosya [UPX](https://upx.github.io) kullanılarak sıkıştırılır.
Linux'ta, oluşturulan ikili dosya derleme sırasında `COMPRESS=1` ortam değişkeni ayarlanarak [UPX](https://upx.github.io) ile sıkıştırılabilir.

Mac'te, göndermeden önce dosyanın boyutunu küçültmek için sıkıştırabilirsiniz.
Biz `xz` öneririz.
2 changes: 1 addition & 1 deletion static-builder-gnu.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ARG CLEAN=''
ARG EMBED=''
ARG DEBUG_SYMBOLS=''
ARG MIMALLOC=''
ARG NO_COMPRESS=''
ARG COMPRESS=''

# Go
ARG GO_VERSION
Expand Down
2 changes: 1 addition & 1 deletion static-builder-musl.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ARG CLEAN=''
ARG EMBED=''
ARG DEBUG_SYMBOLS=''
ARG MIMALLOC=''
ARG NO_COMPRESS=''
ARG COMPRESS=''

ENV GOTOOLCHAIN=local

Expand Down
Loading