Skip to content

Commit 9167478

Browse files
committed
Build libwatcher for frankenphp + binaries from the official images
1 parent 2cca1ce commit 9167478

File tree

4 files changed

+39
-46
lines changed

4 files changed

+39
-46
lines changed

.github/workflows/Dockerfile.centos-php-test-zts

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ RUN yum install -y yum-utils && \
1919
dnf config-manager --set-enabled crb || dnf config-manager --set-enabled powertools || true
2020

2121
# Install minimal tools needed for re2c build (replace curl-minimal with full curl)
22-
RUN yum install -y xz tar gcc gcc-c++ make
22+
RUN yum install -y xz tar gcc gcc-c++ make cmake
2323

2424
ENV RE2C_VERSION=3.1
2525
RUN curl -fsSL -o /tmp/re2c.tar.xz https://github.com/skvadrik/re2c/releases/download/${RE2C_VERSION}/re2c-${RE2C_VERSION}.tar.xz \
@@ -93,6 +93,19 @@ RUN ./configure \
9393
&& make install \
9494
&& strip /usr/local/bin/php /usr/local/sbin/php-fpm || true
9595

96+
WORKDIR /usr/src
97+
RUN git clone https://github.com/e-dant/watcher.git
98+
WORKDIR /usr/src/watcher
99+
RUN cmake -S . -B build \
100+
-DCMAKE_BUILD_TYPE=Release \
101+
-DCMAKE_INSTALL_PREFIX=/usr/local \
102+
-DBUILD_LIB=ON \
103+
-DBUILD_BIN=ON \
104+
-DBUILD_HDR=ON && \
105+
cmake --build build && \
106+
cmake --install build && \
107+
ldconfig
108+
96109
FROM base AS final
97110

98111
COPY --from=php-build /usr/local /usr/local
@@ -101,16 +114,9 @@ COPY frankenphp-binary/ /tmp/frankenphp-binary/
101114
RUN if [ -f /tmp/frankenphp-binary/frankenphp ]; then \
102115
cp /tmp/frankenphp-binary/frankenphp /usr/local/bin/frankenphp && \
103116
chmod +x /usr/local/bin/frankenphp && \
104-
[ -f /tmp/frankenphp-binary/lib/libphp.so ] && cp /tmp/frankenphp-binary/lib/libphp.so /usr/local/lib/libphp.so || true && \
105-
[ -f /tmp/frankenphp-binary/lib/libwatcher-c.so.0 ] && cp /tmp/frankenphp-binary/lib/libwatcher-c.so.0 /usr/local/lib/libwatcher-c.so.0 || true && \
106-
[ -f /tmp/frankenphp-binary/lib/libargon2.so.1 ] && cp /tmp/frankenphp-binary/lib/libargon2.so.1 /usr/local/lib/libargon2.so.1 || true && \
107-
mkdir -p /etc/frankenphp/caddy.d \
108-
&& mkdir -p /etc/frankenphp/php.d \
109-
&& mkdir -p /usr/lib/frankenphp/modules \
110-
&& echo "/usr/local/lib" > /etc/ld.so.conf.d/usr-local-lib.conf \
111-
&& ldconfig \
112-
&& echo "FrankenPHP installed. Checking dependencies:" \
113-
&& ldd /usr/local/bin/frankenphp 2>/dev/null | grep -E "libphp|libargon2|not found" || true; \
117+
mkdir -p /etc/frankenphp/caddy.d && \
118+
mkdir -p /etc/frankenphp/php.d && \
119+
mkdir -p /usr/lib/frankenphp/modules; \
114120
fi
115121

116122
RUN EXTENSION_DIR=$(php -i | grep "^extension_dir" | awk '{print $3}') && \
@@ -176,10 +182,10 @@ RUN mkdir -p /etc/php-fpm.d && \
176182
RUN echo "mysqli.default_socket = /var/lib/mysql/mysql.sock" > /usr/local/etc/php/conf.d/mysql-socket.ini
177183

178184
RUN if [ -f /usr/local/bin/frankenphp ]; then \
179-
frankenphp -v || echo "Warning: frankenphp version check failed"; \
180-
else \
181-
echo "WARNING: frankenphp binary not found; FrankenPHP-specific tests will be skipped."; \
182-
fi
185+
frankenphp -v || echo "Warning: frankenphp version check failed"; \
186+
else \
187+
echo "WARNING: frankenphp binary not found; FrankenPHP-specific tests will be skipped."; \
188+
fi
183189

184190
# Python deps used by test harness
185191
RUN python3 -m pip install --no-cache-dir --upgrade pip && \

.github/workflows/Dockerfile.ubuntu-php-test-zts

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ RUN apt-get update && \
2525
build-essential autoconf bison re2c pkg-config \
2626
libxml2-dev libsqlite3-dev libcurl4-openssl-dev libssl-dev \
2727
libzip-dev libonig-dev libjpeg-dev libpng-dev libwebp-dev \
28-
libicu-dev libreadline-dev libxslt1-dev default-libmysqlclient-dev \
28+
libicu-dev libreadline-dev libxslt1-dev default-libmysqlclient-dev cmake \
2929
&& rm -rf /var/lib/apt/lists/*
3030

3131
# Timezone to UTC
@@ -76,7 +76,6 @@ RUN ./configure \
7676
--enable-mbstring \
7777
--enable-pcntl \
7878
--enable-cgi \
79-
--enable-embed \
8079
--with-extra-version="" \
8180
--with-curl \
8281
--with-mysqli \
@@ -87,6 +86,19 @@ RUN ./configure \
8786
&& make install \
8887
&& strip /usr/local/bin/php /usr/local/sbin/php-fpm || true
8988

89+
WORKDIR /usr/src
90+
RUN git clone https://github.com/e-dant/watcher.git
91+
WORKDIR /usr/src/watcher
92+
RUN cmake -S . -B build \
93+
-DCMAKE_BUILD_TYPE=Release \
94+
-DCMAKE_INSTALL_PREFIX=/usr/local \
95+
-DBUILD_LIB=ON \
96+
-DBUILD_BIN=ON \
97+
-DBUILD_HDR=ON && \
98+
cmake --build build && \
99+
cmake --install build && \
100+
ldconfig
101+
90102
# Final image with PHP and test infrastructure
91103
FROM base AS final
92104

@@ -96,16 +108,9 @@ COPY frankenphp-binary/ /tmp/frankenphp-binary/
96108
RUN if [ -f /tmp/frankenphp-binary/frankenphp ]; then \
97109
cp /tmp/frankenphp-binary/frankenphp /usr/local/bin/frankenphp && \
98110
chmod +x /usr/local/bin/frankenphp && \
99-
[ -f /tmp/frankenphp-binary/lib/libphp.so ] && cp /tmp/frankenphp-binary/lib/libphp.so /usr/local/lib/libphp.so || true && \
100-
[ -f /tmp/frankenphp-binary/lib/libwatcher-c.so.0 ] && cp /tmp/frankenphp-binary/lib/libwatcher-c.so.0 /usr/local/lib/libwatcher-c.so.0 || true && \
101-
[ -f /tmp/frankenphp-binary/lib/libargon2.so.1 ] && cp /tmp/frankenphp-binary/lib/libargon2.so.1 /usr/local/lib/libargon2.so.1 || true && \
102-
mkdir -p /etc/frankenphp/caddy.d \
103-
&& mkdir -p /etc/frankenphp/php.d \
104-
&& mkdir -p /usr/lib/frankenphp/modules \
105-
&& echo "/usr/local/lib" > /etc/ld.so.conf.d/usr-local-lib.conf \
106-
&& ldconfig \
107-
&& echo "FrankenPHP installed. Checking dependencies:" \
108-
&& ldd /usr/local/bin/frankenphp 2>/dev/null | grep -E "libphp|libargon2|not found" || true; \
111+
mkdir -p /etc/frankenphp/caddy.d && \
112+
mkdir -p /etc/frankenphp/php.d && \
113+
mkdir -p /usr/lib/frankenphp/modules; \
109114
fi
110115

111116

.github/workflows/build-centos-php-test-images-zts.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
docker create --platform linux/amd64 --name temp-frankenphp dunglas/frankenphp:php${PHP_VERSION}-bookworm
4040
docker cp temp-frankenphp:/usr/local/bin/frankenphp frankenphp-binary/frankenphp
4141
mkdir -p frankenphp-binary/lib
42-
docker cp temp-frankenphp:/usr/local/lib/libphp.so frankenphp-binary/lib/libphp.so
42+
echo "NOTE: Not copying libphp.so for CentOS (GLIBC 2.34) - using compiled version"
4343
docker cp temp-frankenphp:/usr/local/lib/libwatcher-c.so.0 frankenphp-binary/lib/libwatcher-c.so.0 || true
4444
docker cp temp-frankenphp:/lib/x86_64-linux-gnu/libargon2.so.1 frankenphp-binary/lib/libargon2.so.1 || true
4545
docker rm temp-frankenphp
@@ -86,15 +86,6 @@ jobs:
8686
docker pull --platform linux/arm64 dunglas/frankenphp:php${PHP_VERSION}-bookworm
8787
docker create --platform linux/arm64 --name temp-frankenphp dunglas/frankenphp:php${PHP_VERSION}-bookworm
8888
docker cp temp-frankenphp:/usr/local/bin/frankenphp frankenphp-binary/frankenphp
89-
mkdir -p frankenphp-binary/lib
90-
docker cp temp-frankenphp:/usr/local/lib/libphp.so frankenphp-binary/lib/libphp.so
91-
docker cp temp-frankenphp:/usr/local/lib/libwatcher-c.so.0 frankenphp-binary/lib/libwatcher-c.so.0 || true
92-
docker cp temp-frankenphp:/lib/aarch64-linux-gnu/libargon2.so.1 frankenphp-binary/lib/libargon2.so.1 || true
93-
docker rm temp-frankenphp
94-
chmod +x frankenphp-binary/frankenphp
95-
echo "Extracted FrankenPHP files:"
96-
ls -lh frankenphp-binary/
97-
ls -lh frankenphp-binary/lib/ || true
9889
9990
- name: Build & push (arm64)
10091
uses: docker/build-push-action@v6

.github/workflows/build-ubuntu-php-test-images-zts.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,6 @@ jobs:
8383
docker pull --platform linux/arm64 dunglas/frankenphp:php${PHP_VERSION}-bookworm
8484
docker create --platform linux/arm64 --name temp-frankenphp dunglas/frankenphp:php${PHP_VERSION}-bookworm
8585
docker cp temp-frankenphp:/usr/local/bin/frankenphp frankenphp-binary/frankenphp
86-
mkdir -p frankenphp-binary/lib
87-
docker cp temp-frankenphp:/usr/local/lib/libphp.so frankenphp-binary/lib/libphp.so
88-
docker cp temp-frankenphp:/usr/local/lib/libwatcher-c.so.0 frankenphp-binary/lib/libwatcher-c.so.0 || true
89-
docker cp temp-frankenphp:/lib/aarch64-linux-gnu/libargon2.so.1 frankenphp-binary/lib/libargon2.so.1 || true
90-
docker rm temp-frankenphp
91-
chmod +x frankenphp-binary/frankenphp
92-
echo "Extracted FrankenPHP files:"
93-
ls -lh frankenphp-binary/
94-
ls -lh frankenphp-binary/lib/ || true
9586
9687
- uses: docker/build-push-action@v6
9788
with:

0 commit comments

Comments
 (0)