_lf1
(lf)
March 10, 2024, 8:11pm
1
1. The problem I’m having:
I have undid and redid alpine and can not get this to work, it worked october.
I did ask on the frakenphp github, but he closed the issue,I can ask again since the error changed, i just thought you may know too, and dunglas may not want to be bothered a that much by one person.
plus its probably something that was announced somewhere i didn’t see.
2. Error messages and/or full log output:
=> => # 2024/03/10 20:06:17 [INFO] exec (timeout=0s): /usr/local/go/bin/go build -o /src/caddy -ldflags -w -s
=> => # # github.com/dunglas/frankenphp
=> => # /go/pkg/mod/github.com/dunglas/frankenphp@v1.1.0/frankenphp.go:30:11: fatal error: php_variables.h: No such file or directory
=> => # 30 | // #include <php_variables.h>
=> => # | ^~~~~~~~~~~~~~~~~
=> => # compilation terminated.
3. Caddy version:
FROM caddy:2.7.6-builder AS builder
4. How I installed and ran Caddy:
Dockerfile
#syntax=docker/dockerfile:1
FROM caddy:2.7.6-builder-alpine AS builder
RUN apk --no-cache add make git gcc libtool musl-dev ca-certificates dumb-init
RUN echo "http://dl-cdn.alpinelinux.org/alpine/v3.19/community" | tee -a /etc/apk/repositories
RUN apk update
#ADD apk_repositories /etc/apk/repositories
RUN apk --no-cache add php82 php82-dev
WORKDIR /src
#RUN apt install -y build-essential automake autoconf bison re2c libsqlite3-dev git libxml2-dev python3.11 python3.11-dev libtool pkg-config
#RUN git clone -v --depth 1 --branch master https://github.com/GNOME/libxml2.git libxml2
#RUN cd /src/libxml2/ && git remote update && git fetch
# && git checkout tags/v2.12.5
#RUN cd /src/libxml2 autoreconf && ./autogen.sh && ./configure && make && make install
# php
#RUN git clone https://github.com/php/php-src.git php_8_3_3
#RUN cd /src/php_8_3_3 && ./buildconf -f --debug
#RUN cd /src/php_8_3_3 && ./configure && make && make install
#
# xcaddy
#RUN wget https://github.com/caddyserver/xcaddy/releases/download/v0.3.5/xcaddy_0.3.5_linux_amd64.tar.gz
#RUN tar xzvf /src/xcaddy_0.3.5_linux_amd64.tar.gz
ENV CGO_ENABLED=1
ENV XCADDY_GO_BUILD_FLAGS="-ldflags '-w -s'"
#--with github.com/dunglas/frankenphp/caddy
RUN xcaddy build v2.7.6 --with github.com/abiosoft/caddy-exec \
--with github.com/dunglas/frankenphp/caddy \
--with github.com/baldinof/caddy-supervisor \
--with github.com/caddyserver/cache-handler \
--with github.com/aksdb/caddy-cgi/v2@v2.2.0 \
--with github.com/greenpau/caddy-git \
--with github.com/Elegant996/scgi-transport \
--with github.com/mholt/caddy-l4 \
--with github.com/caddy-dns/cloudflare \
--with github.com/greenpau/caddy-security \
--with github.com/greenpau/caddy-trace \
--with github.com/caddyserver/jsonc-adapter \
--with github.com/kadeessh/kadeessh@v0.0.2 \
--with github.com/hslatman/caddy-crowdsec-bouncer \
--with github.com/caddyserver/transform-encoder \
--with github.com/dunglas/mercure/caddy \
--with github.com/dunglas/vulcain/caddy
FROM caddy:2.7.6
COPY --from=builder /src/caddy /usr/bin/caddy
RUN
a. System environment:
Linux redbloom 5.15.0-100-generic #110-Ubuntu SMP Wed Feb 7 13:27:48 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
b. Command:
docker build -t <img-name> .
c. Service/unit/compose file:
N/a
d. My complete Caddy config:
its a bit too long, plus right now it's irrelevant,
but if you want me to share it with the community I will.
5. Links to relevant resources:
opened 08:18PM - 10 Mar 24 UTC
bug
### What happened?
sorry, I had to ask again, I've spent a few hours with no … success. Now the error is related to `php_variables.h`, but i installed `php82` `php82-dev` and verified that php82-dev has the headerfile in question
[alpine:php82-dev](https://pkgs.alpinelinux.org/contents?file=*var*&path=&name=php82-dev&branch=v3.19&repo=community&arch=armhf)
[caddy community thread](https://caddy.community/t/caddy-2-7-6-builder-with-frakenphp/23088)
### Build Type
Docker (Alpine)
### Worker Mode
No
### Operating System
GNU/Linux
### CPU Architecture
x86_64
### PHP configuration
```shell
n/a, but here's the docker file.
#syntax=docker/dockerfile:1
FROM caddy:2.7.6-builder-alpine AS builder
RUN apk --no-cache add make git gcc libtool musl-dev ca-certificates dumb-init
RUN echo "http://dl-cdn.alpinelinux.org/alpine/v3.19/community" | tee -a /etc/apk/repositories
RUN apk update
RUN apk --no-cache add php82 php82-dev
WORKDIR /src
ENV CGO_ENABLED=1
ENV XCADDY_GO_BUILD_FLAGS="-ldflags '-w -s'"
RUN xcaddy build v2.7.6 --with github.com/abiosoft/caddy-exec \
--with github.com/dunglas/frankenphp/caddy \
--with github.com/baldinof/caddy-supervisor \
--with github.com/caddyserver/cache-handler \
--with github.com/aksdb/caddy-cgi/v2@v2.2.0 \
--with github.com/greenpau/caddy-git \
--with github.com/Elegant996/scgi-transport \
--with github.com/mholt/caddy-l4 \
--with github.com/caddy-dns/cloudflare \
--with github.com/greenpau/caddy-security \
--with github.com/greenpau/caddy-trace \
--with github.com/caddyserver/jsonc-adapter \
--with github.com/kadeessh/kadeessh@v0.0.2 \
--with github.com/hslatman/caddy-crowdsec-bouncer \
--with github.com/caddyserver/transform-encoder \
--with github.com/dunglas/mercure/caddy \
--with github.com/dunglas/vulcain/caddy
FROM caddy:2.7.6
COPY --from=builder /src/caddy /usr/bin/caddy
RUN
```
```
### Relevant log output
```shell
=> => # 2024/03/10 20:06:17 [INFO] exec (timeout=0s): /usr/local/go/bin/go build -o /src/caddy -ldflags -w -s
=> => # # github.com/dunglas/frankenphp
=> => # /go/pkg/mod/github.com/dunglas/frankenphp@v1.1.0/frankenphp.go:30:11: fatal error: php_variables.h: No such file or directory
=> => # 30 | // #include <php_variables.h>
=> => # | ^~~~~~~~~~~~~~~~~
=> => # compilation terminated.
```
```
opened 08:54PM - 09 Mar 24 UTC
closed 12:14AM - 10 Mar 24 UTC
bug
### What happened?
use caddy2.7.6-builder docker image
include github.com/… dunglas/frakenphp/caddy
build fail
try include github.com/dunglas/frakenphp/caddy@1.1.0
build fail
try include github.com/dunglas/frakenphp/caddy@1.0.3
build fail
try include github.com/dunglas/frakenphp/caddy@1.0.0
build fail
### Build Type
Docker ubuntu 22.04
### Worker Mode
Yes
### Operating System
GNU/Linux
### CPU Architecture
x86_64
### PHP configuration
```shell
#syntax=docker/dockerfile:1
FROM caddy:2.7.6-builder AS builder
RUN xcaddy build v2.7.6 --with github.com/abiosoft/caddy-exec \
--with github.com/baldinof/caddy-supervisor \
--with github.com/dunglas/frankenphp/caddy@v1.0.0 \
--with github.com/caddyserver/cache-handler \
--with github.com/aksdb/caddy-cgi/v2@v2.2.0 \
--with github.com/greenpau/caddy-git \
--with github.com/Elegant996/scgi-transport \
--with github.com/mholt/caddy-l4 \
--with github.com/caddy-dns/cloudflare \
--with github.com/greenpau/caddy-security \
--with github.com/greenpau/caddy-trace \
--with github.com/caddyserver/jsonc-adapter \
--with github.com/kadeessh/kadeessh@v0.0.2 \
--with github.com/caddyserver/transform-encoder
FROM caddy:2.7.6
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
RUN
```
### Relevant log output
```shell
=> [builder 2/2] RUN xcaddy build v2.7.6 --with github.com/abiosoft/caddy-exec --with... 214.4s
=> => # # github.com/dunglas/frankenphp
=> => # /go/pkg/mod/github.com/dunglas/frankenphp@v1.0.0/request_options.go:10:28: undefined: FrankenPHPContext
=> => # /go/pkg/mod/github.com/dunglas/frankenphp@v1.0.0/request_options.go:20:17: undefined: FrankenPHPContext
=> => # /go/pkg/mod/github.com/dunglas/frankenphp@v1.0.0/request_options.go:48:17: undefined: FrankenPHPContext
=> => # /go/pkg/mod/github.com/dunglas/frankenphp@v1.0.0/request_options.go:58:17: undefined: FrankenPHPContext
=> => # /go/pkg/mod/github.com/dunglas/frankenphp@v1.0.0/request_options.go:67:17: undefined: FrankenPHPContext
```
If you’re using FrankenPHP, you probably shouldn’t use the caddy-builder
image. Use the instructions at the FrankenPHP docs instead: FrankenPHP: the modern PHP app server
Are you sure you need all those plugins? Only add plugins you actually need. Don’t bloat your installation.
_lf1
(lf)
March 10, 2024, 9:11pm
3
You are right, i do not need them all in the same executable, i was wondering if they would still compile, and if i remove frankenphp it all compiles.
I seem to have missed this part XCADDY_SETCAP=1
.
I will try some more later.
The problem is that FrankenPHP requires having libphp installed before trying to build. The caddy-builder
image won’t have that. The dunglas/frankenphp
image does, so you should use that as a base instead, as per their docs. You’ll still be using xcaddy
to build, and can add whatever plugins.
_lf1
(lf)
March 10, 2024, 9:15pm
5
i didnt mean to make you do my work
i will send 10$ to the github project for you and frakenphp.
system
(system)
Closed
April 9, 2024, 9:15pm
6
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.