Caddy:2.7.6-builder with Frakenphp

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. :innocent:

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:

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.

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.

i didnt mean to make you do my work
i will send 10$ to the github project for you and frakenphp.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.