Closed g-ra closed 3 months ago
This isn't a bug. You have to install php sources to compile frankenphp. FWIW, it's much simpler to do this by basing off of the php images and/or frankenphp builder images.
@withinboredom sry, can you share example ?
FROM php:8.3-fpm-bullseye AS builder
# Install necessary packages
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
build-essential \
wget \
ca-certificates \
libxml2-dev \
libssl-dev \
libcurl4-openssl-dev \
pkg-config \
zlib1g-dev \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
libonig-dev \
libzip-dev \
libicu-dev \
&& rm -rf /var/lib/apt/lists/*
# Install Go
ENV GO_VERSION=1.21.1
RUN wget https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz && \
rm go${GO_VERSION}.linux-amd64.tar.gz
# Set Go environment variables
ENV GOROOT=/usr/local/go
ENV GOPATH=/go
ENV PATH=$GOROOT/bin:$GOPATH/bin:$PATH
# Install xcaddy
RUN go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
# Clone FrankenPHP repository
RUN git clone https://github.com/dunglas/frankenphp.git /src/frankenphp
WORKDIR /src/frankenphp
# Set environment variables for PIE
ENV CGO_ENABLED=1
ENV XCADDY_SETCAP=1
ENV XCADDY_GO_BUILD_FLAGS="-ldflags \"-w -s -extldflags '-Wl,-z,stack-size=0x80000'\""
ENV CGO_CFLAGS="-fPIC" \
CGO_LDFLAGS="-pie" \
GOFLAGS="-buildmode=pie"
# Build FrankenPHP with xcaddy
RUN xcaddy build \
--output /usr/local/bin/frankenphp \
--with github.com/dunglas/frankenphp \
--with github.com/dunglas/frankenphp/caddy \
--with github.com/dunglas/mercure/caddy \
--with github.com/dunglas/vulcain/caddy \
--with github.com/darkweak/souin \
--with github.com/caddyserver/cache-handler
did I understand you correctly ?
109.5 go: downloading cloud.google.com/go/compute v1.24.0
110.3 2024/08/01 07:04:48 [INFO] exec (timeout=0s): /usr/local/go/bin/go build -o /usr/local/bin/frankenphp -ldflags -w -s -extldflags '-Wl,-z,stack-size=0x80000'
127.8 # github.com/dunglas/frankenphp
127.8 frankenphp.c:15:10: fatal error: sapi/embed/php_embed.h: No such file or directory
127.8 15 | #include <sapi/embed/php_embed.h>
127.8 | ^~~~~~~~~~~~~~~~~~~~~~~~
127.8 compilation terminated.
130.7 2024/08/01 07:05:09 [INFO] Cleaning up temporary folder: /tmp/buildenv_2024-08-01-0702.3424651328
130.7 2024/08/01 07:05:09 [FATAL] exit status 1
------
failed to solve: process "/bin/sh -c xcaddy build --output /usr/local/bin/frankenphp --with github.com/dunglas/frankenphp --with github.com/dunglas/frankenphp/caddy --with github.com/dunglas/mercure/caddy --with github.com/dunglas/vulcain/caddy --with github.com/darkweak/souin --with github.com/caddyserver/cache-handler" did not complete successfully: exit code: 1
@withinboredom use frankenphp builder images ? https://github.com/dunglas/frankenphp/issues/944
@g-ra I think he means using the builder image like described here in the docs.
What happened?
i cant install cache-handler for xcaddy
Build Type
Docker (Debian Bookworm)
Worker Mode
Yes
Operating System
GNU/Linux
CPU Architecture
x86_64
PHP configuration
Relevant log output