Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ functions:
| RdKafka | `${bref-extra:rdkafka-php-81}` |
| Redis (phpredis) | `${bref-extra:redis-php-81}` |
| Redis-Igbinary | `${bref-extra:redis-igbinary-php-81}` |
| Relay | `${bref-extra:relay-php-81}` |
| Relay | `${bref-extra:relay-php-82}` |
| Scout APM | `${bref-extra:scoutapm-php-81}` |
| Scrypt | `${bref-extra:scrypt-php-81}` |
| SNMP | `${bref-extra:snmp-php-81}` |
Expand Down
47 changes: 12 additions & 35 deletions layers/relay/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# syntax = docker/dockerfile:1.4
ARG PHP_VERSION
ARG BREF_VERSION
FROM bref/build-php-$PHP_VERSION:2 AS ext
FROM bref/build-php-$PHP_VERSION:3 AS ext

ARG RELAY_VERSION=0.9.1
# Leave empty to install the latest stable release
ARG RELAY_VERSION=

# Docs: https://relay.so/docs/1.x/installation#manual-installation

# Install extensions required by Relay
# Install optional extensions
RUN pecl install igbinary msgpack && \
cp `php-config --extension-dir`/igbinary.so /tmp/igbinary.so && \
cp `php-config --extension-dir`/msgpack.so /tmp/msgpack.so && \
Expand All @@ -26,41 +27,17 @@ RUN <<'END' bash -e
END


# Install OpenSSL 1.1 because Relay doesn't work with OpenSSL 3
# https://github.com/openssl/openssl/releases
ENV VERSION_OPENSSL=1.1.1w
ENV OPENSSL_BUILD_DIR=${BUILD_DIR}/openssl
ENV CA_BUNDLE_SOURCE="https://curl.se/ca/cacert.pem"
ENV CA_BUNDLE="${INSTALL_DIR}/bref/ssl/cert.pem"
RUN rm -rf ${OPENSSL_BUILD_DIR}
RUN set -xe; \
mkdir -p ${OPENSSL_BUILD_DIR}; \
curl -Ls https://github.com/openssl/openssl/archive/OpenSSL_${VERSION_OPENSSL//./_}.tar.gz \
| tar xzC ${OPENSSL_BUILD_DIR} --strip-components=1
WORKDIR ${OPENSSL_BUILD_DIR}/
RUN CFLAGS="" \
CPPFLAGS="-I${INSTALL_DIR}/include -I/usr/include" \
LDFLAGS="-L${INSTALL_DIR}/lib64 -L${INSTALL_DIR}/lib" \
./config \
--prefix=${INSTALL_DIR} \
--openssldir=${INSTALL_DIR}/bref/ssl \
--release \
no-tests \
shared \
zlib
# Explicitly compile make without parallelism because it fails if we use -jX (no error message)
# I'm not 100% sure why, and I already lost 4 hours on this, but I found this:
# https://github.com/openssl/openssl/issues/9931
# https://stackoverflow.com/questions/28639207/why-cant-i-compile-openssl-with-multiple-threads-make-j3
# Run `make install_sw install_ssldirs` instead of `make install` to skip installing man pages https://github.com/openssl/openssl/issues/8170
RUN make -j1 install_sw install_ssldirs
RUN mkdir -p ${INSTALL_DIR}/bref/ssl && curl -Lk -o ${CA_BUNDLE} ${CA_BUNDLE_SOURCE}


RUN <<'END' bash -e
export php_version=$(php-config --version | cut -c -3)
# Resolve the latest stable release when no version is pinned
if [ -z "$RELAY_VERSION" ]; then
RELAY_VERSION=$(curl -sSL "https://builds.r2.relay.so/meta/latest" | sed 's/^v//')
fi
# Relay's arch suffix: x86_64 -> x86-64, aarch64 stays aarch64
ARCH=$(uname -m | sed 's/_/-/')
# el9 build links the system OpenSSL 3 / glibc from Amazon Linux 2023
mkdir -p /tmp/relay
curl -sSL "https://builds.r2.relay.so/v$RELAY_VERSION/relay-v$RELAY_VERSION-php$php_version-centos7-x86-64.tar.gz" | tar -xz --strip-components=1 -C /tmp/relay
curl -sSL "https://builds.r2.relay.so/v$RELAY_VERSION/relay-v$RELAY_VERSION-php$php_version-el9-$ARCH.tar.gz" | tar -xz --strip-components=1 -C /tmp/relay
sed -i "s/00000000-0000-0000-0000-000000000000/$(cat /proc/sys/kernel/random/uuid)/" /tmp/relay/relay-pkg.so
cp /tmp/relay/relay-pkg.so /tmp/relay.so
echo 'extension=relay.so' > /tmp/ext-relay.ini
Expand Down
4 changes: 4 additions & 0 deletions layers/relay/config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"php": [
"82",
"83",
"84",
"85"
]
}
Loading