mirror of
https://github.com/dunglas/frankenphp.git
synced 2025-12-24 13:38:11 +08:00
ci: build .rpm and .deb packages (#1497)
* add ./create-rpm.sh file to build a "frankenphp" rpm package * also build a deb package * renamed to build-packages * linter... * add depends * linter again? * linter number 3 * linter number 4 * set default locations for ini file, conf files and extensions * set unified path for modules that should be ok on all dists * add default content into "package" folder * make file executable * worker is in public folder * what on earth did I do x) * use same FRANKENPHP_VERSION and make sure to let pr's run the rpm generation too (version 0.0.0) to see issues * install ruby, fpm and rpm-build * move to after changing base urls because it would fail with packages not found * ruby 3 build needs gcc 10 * rpm-build is necessary too... * and I forgot to link the package folder * create directories if they don't exist * copy out all frankenphp* files? * lint fix * only copy frankenphp-* files * only copy frankenphp-* files * the .deb file is name frankenphp_1.5.0... - create output folder instead and upload all things inside that will simplify things when later adding xdebug.so and ffi.so * update the last two steps to use the gh-output directory * add post install script to set frankenphp able to bind to port 80 for non-root users * dnf over yum, I think the yum alias was removed in RH 9.5 * newlines * newlines * add text what missing libcap means * copy php.ini-production from php-src, linter, update ruby version * move Caddyfile to /etc/frankenphp/Caddyfile * linter * fix a copy and paste error * better describe fallback to 0.0.0 * linter * copy installation scripts from official caddy packages, change user to frankenphp too * bombombom * make files executable * tabs * linter * linter again * use empty directory for three different destinations instead of keeping three empty local directories * caddy says the file is incorrectly formatted without these spaces * remove wildcard matcher from root directive * Apply suggestions from code review commit suggested changes to preinstall/postinstall scripts Co-authored-by: Kévin Dunglas <kevin@dunglas.fr> * Update dev.Dockerfile Co-authored-by: Kévin Dunglas <kevin@dunglas.fr> * remove misleading comment * update documentation for paths * update documentation for paths some more * fix musl opcache-jit issue * markdown linter * the damn tab * Apply suggestions from code review Co-authored-by: Kévin Dunglas <kevin@dunglas.fr> * drop dev.Dockerfile php location from config.md * add php config note to CONTRIBUTING.md * dashes instead of asterisks in chinese docs * fix package building * create frankenphp user in case it doesn't exist for deb packages * create users if they don't exist, delete them again if they didn't exist * satisfy linter * create the user with the same commands as the postinst/preinstall scripts * Removes toolchain requirements. * trigger * Removes explicit calls to go get * trigger * setcap by default * simplify example project * bring page more in line with the caddy / apache / nginx default page * update to html 5 * oopsies * revert style to original * remove https:// (caddy uses http:// on RHEL, :80 on Debian) --------- Co-authored-by: Kévin Dunglas <kevin@dunglas.fr> Co-authored-by: Alliballibaba <alliballibaba@gmail.com>
This commit is contained in:
@@ -11,9 +11,13 @@ docker build -t frankenphp-dev -f dev.Dockerfile .
|
||||
docker run --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -p 8080:8080 -p 443:443 -p 443:443/udp -v $PWD:/go/src/app -it frankenphp-dev
|
||||
```
|
||||
|
||||
该镜像包含常用的开发工具(Go、GDB、Valgrind、Neovim等)。
|
||||
该镜像包含常用的开发工具(Go、GDB、Valgrind、Neovim等)并使用以下 php 设置位置
|
||||
|
||||
如果 docker 版本低于 23.0,则会因为 dockerignore [pattern issue](https://github.com/moby/moby/pull/42676) 而导致构建失败。将目录添加到 `.dockerignore`。
|
||||
- php.ini: `/etc/frankenphp/php.ini` 默认提供了一个带有开发预设的 php.ini 文件。
|
||||
- 附加配置文件: `/etc/frankenphp/php.d/*.ini`
|
||||
- php 扩展: `/usr/lib/frankenphp/modules/`
|
||||
|
||||
如果您的 docker 版本低于 23.0,则会因为 dockerignore [pattern issue](https://github.com/moby/moby/pull/42676) 而导致构建失败。将目录添加到 `.dockerignore`。
|
||||
|
||||
```patch
|
||||
!testdata/*.php
|
||||
@@ -179,20 +183,20 @@ docker buildx bake -f docker-bake.hcl --pull --no-cache --push
|
||||
|
||||
## 其他开发资源
|
||||
|
||||
* [PHP 嵌入 uWSGI](https://github.com/unbit/uwsgi/blob/master/plugins/php/php_plugin.c)
|
||||
* [PHP 嵌入 NGINX Unit](https://github.com/nginx/unit/blob/master/src/nxt_php_sapi.c)
|
||||
* [PHP 嵌入 Go (go-php)](https://github.com/deuill/go-php)
|
||||
* [PHP 嵌入 Go (GoEmPHP)](https://github.com/mikespook/goemphp)
|
||||
* [PHP 嵌入 C++](https://gist.github.com/paresy/3cbd4c6a469511ac7479aa0e7c42fea7)
|
||||
* [扩展和嵌入 PHP 作者:Sara Golemon](https://books.google.fr/books?id=zMbGvK17_tYC&pg=PA254&lpg=PA254#v=onepage&q&f=false)
|
||||
* [TSRMLS_CC到底是什么?](http://blog.golemon.com/2006/06/what-heck-is-tsrmlscc-anyway.html)
|
||||
* [Mac 上的 PHP 嵌入](https://gist.github.com/jonnywang/61427ffc0e8dde74fff40f479d147db4)
|
||||
* [SDL 绑定](https://pkg.go.dev/github.com/veandco/go-sdl2@v0.4.21/sdl#Main)
|
||||
- [PHP 嵌入 uWSGI](https://github.com/unbit/uwsgi/blob/master/plugins/php/php_plugin.c)
|
||||
- [PHP 嵌入 NGINX Unit](https://github.com/nginx/unit/blob/master/src/nxt_php_sapi.c)
|
||||
- [PHP 嵌入 Go (go-php)](https://github.com/deuill/go-php)
|
||||
- [PHP 嵌入 Go (GoEmPHP)](https://github.com/mikespook/goemphp)
|
||||
- [PHP 嵌入 C++](https://gist.github.com/paresy/3cbd4c6a469511ac7479aa0e7c42fea7)
|
||||
- [扩展和嵌入 PHP 作者:Sara Golemon](https://books.google.fr/books?id=zMbGvK17_tYC&pg=PA254&lpg=PA254#v=onepage&q&f=false)
|
||||
- [TSRMLS_CC到底是什么?](http://blog.golemon.com/2006/06/what-heck-is-tsrmlscc-anyway.html)
|
||||
- [Mac 上的 PHP 嵌入](https://gist.github.com/jonnywang/61427ffc0e8dde74fff40f479d147db4)
|
||||
- [SDL 绑定](https://pkg.go.dev/github.com/veandco/go-sdl2@v0.4.21/sdl#Main)
|
||||
|
||||
## Docker 相关资源
|
||||
|
||||
* [Bake 文件定义](https://docs.docker.com/build/customize/bake/file-definition/)
|
||||
* [docker buildx 构建](https://docs.docker.com/engine/reference/commandline/buildx_build/)
|
||||
- [Bake 文件定义](https://docs.docker.com/build/customize/bake/file-definition/)
|
||||
- [docker buildx 构建](https://docs.docker.com/engine/reference/commandline/buildx_build/)
|
||||
|
||||
## 有用的命令
|
||||
|
||||
|
||||
@@ -2,12 +2,17 @@
|
||||
|
||||
FrankenPHP,Caddy 以及 Mercure 和 Vulcain 模块可以使用 [Caddy 支持的格式](https://caddyserver.com/docs/getting-started#your-first-config) 进行配置。
|
||||
|
||||
在[Docker 映像](docker.md) 中,`Caddyfile` 位于 `/etc/caddy/Caddyfile`。
|
||||
在[Docker 映像](docker.md) 中,`Caddyfile` 位于 `/etc/frankenphp/Caddyfile`。
|
||||
静态二进制文件会在启动时所在的目录中查找 `Caddyfile`。
|
||||
PHP 本身可以[使用 `php.ini` 文件](https://www.php.net/manual/zh/configuration.file.php)进行配置。
|
||||
默认情况下,随 Docker 映像提供的 PHP 和静态二进制文件中包含的 PHP 将在启动 FrankenPHP 的目录和 `/usr/local/etc/php/` 中查找`php.ini` 文件。它们还会从 `/usr/local/etc/php/conf.d/` 中加载所有以 `.ini` 结尾的文件。
|
||||
默认情况下没有 `php.ini` 文件,因此应复制 PHP 项目提供的官方模板。
|
||||
在 Docker 上,模板在镜像中提供:
|
||||
PHP 解释器将在以下位置查找:
|
||||
|
||||
Docker:
|
||||
|
||||
- php.ini: `/usr/local/etc/php/php.ini` 默认情况下不提供 php.ini。
|
||||
- 附加配置文件: `/usr/local/etc/php/conf.d/*.ini`
|
||||
- php 扩展: `/usr/local/lib/php/extensions/no-debug-zts-<YYYYMMDD>/`
|
||||
- 您应该复制 PHP 项目提供的官方模板:
|
||||
|
||||
```dockerfile
|
||||
FROM dunglas/frankenphp
|
||||
@@ -19,7 +24,18 @@ RUN cp $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini
|
||||
RUN cp $PHP_INI_DIR/php.ini-development $PHP_INI_DIR/php.ini
|
||||
```
|
||||
|
||||
如果不使用 Docker,请复制[PHP 源代码](https://github.com/php/php-src/)中提供的`php.ini-production`或`php.ini-development`中的一个。
|
||||
FrankenPHP 安装 (.rpm 或 .deb):
|
||||
|
||||
- php.ini: `/etc/frankenphp/php.ini` 默认情况下提供带有生产预设的 php.ini 文件。
|
||||
- 附加配置文件: `/etc/frankenphp/php.d/*.ini`
|
||||
- php 扩展: `/usr/lib/frankenphp/modules/`
|
||||
|
||||
静态二进制:
|
||||
|
||||
- php.ini: 执行 `frankenphp run` 或 `frankenphp php-server` 的目录,然后是 `/etc/frankenphp/php.ini`
|
||||
- 附加配置文件: `/etc/frankenphp/php.d/*.ini`
|
||||
- php 扩展: 无法加载
|
||||
- 复制[PHP 源代码](https://github.com/php/php-src/)中提供的`php.ini-production`或`php.ini-development`中的一个。
|
||||
|
||||
## Caddyfile 配置
|
||||
|
||||
@@ -133,9 +149,9 @@ php_server [<matcher>] {
|
||||
|
||||
以下环境变量可用于在 `Caddyfile` 中注入 Caddy 指令,而无需对其进行修改:
|
||||
|
||||
* `SERVER_NAME`: 更改 [要监听的地址](https://caddyserver.com/docs/caddyfile/concepts#addresses),提供的主机名也将用于生成的 TLS 证书
|
||||
* `CADDY_GLOBAL_OPTIONS`: 注入 [全局选项](https://caddyserver.com/docs/caddyfile/options)
|
||||
* `FRANKENPHP_CONFIG`: 在 `frankenphp` 指令下注入配置
|
||||
- `SERVER_NAME`: 更改 [要监听的地址](https://caddyserver.com/docs/caddyfile/concepts#addresses),提供的主机名也将用于生成的 TLS 证书
|
||||
- `CADDY_GLOBAL_OPTIONS`: 注入 [全局选项](https://caddyserver.com/docs/caddyfile/options)
|
||||
- `FRANKENPHP_CONFIG`: 在 `frankenphp` 指令下注入配置
|
||||
|
||||
## PHP 配置
|
||||
|
||||
|
||||
Reference in New Issue
Block a user