11# syntax = docker/dockerfile:1.4
22ARG PHP_VERSION
33ARG BREF_VERSION
4- FROM bref/build-php-$PHP_VERSION:2 AS ext
4+ FROM bref/build-php-$PHP_VERSION:3 AS ext
55
6- ARG RELAY_VERSION=0.9.1
6+ # Leave empty to install the latest stable release
7+ ARG RELAY_VERSION=0.30.0
78
89# Docs: https://relay.so/docs/1.x/installation#manual-installation
910
10- # Install extensions required by Relay
11+ # Install optional extensions
1112RUN pecl install igbinary msgpack && \
1213 cp `php-config --extension-dir`/igbinary.so /tmp/igbinary.so && \
1314 cp `php-config --extension-dir`/msgpack.so /tmp/msgpack.so && \
@@ -26,41 +27,17 @@ RUN <<'END' bash -e
2627END
2728
2829
29- # Install OpenSSL 1.1 because Relay doesn't work with OpenSSL 3
30- # https://github.com/openssl/openssl/releases
31- ENV VERSION_OPENSSL=1.1.1w
32- ENV OPENSSL_BUILD_DIR=${BUILD_DIR}/openssl
33- ENV CA_BUNDLE_SOURCE="https://curl.se/ca/cacert.pem"
34- ENV CA_BUNDLE="${INSTALL_DIR}/bref/ssl/cert.pem"
35- RUN rm -rf ${OPENSSL_BUILD_DIR}
36- RUN set -xe; \
37- mkdir -p ${OPENSSL_BUILD_DIR}; \
38- curl -Ls https://github.com/openssl/openssl/archive/OpenSSL_${VERSION_OPENSSL//./_}.tar.gz \
39- | tar xzC ${OPENSSL_BUILD_DIR} --strip-components=1
40- WORKDIR ${OPENSSL_BUILD_DIR}/
41- RUN CFLAGS="" \
42- CPPFLAGS="-I${INSTALL_DIR}/include -I/usr/include" \
43- LDFLAGS="-L${INSTALL_DIR}/lib64 -L${INSTALL_DIR}/lib" \
44- ./config \
45- --prefix=${INSTALL_DIR} \
46- --openssldir=${INSTALL_DIR}/bref/ssl \
47- --release \
48- no-tests \
49- shared \
50- zlib
51- # Explicitly compile make without parallelism because it fails if we use -jX (no error message)
52- # I'm not 100% sure why, and I already lost 4 hours on this, but I found this:
53- # https://github.com/openssl/openssl/issues/9931
54- # https://stackoverflow.com/questions/28639207/why-cant-i-compile-openssl-with-multiple-threads-make-j3
55- # Run `make install_sw install_ssldirs` instead of `make install` to skip installing man pages https://github.com/openssl/openssl/issues/8170
56- RUN make -j1 install_sw install_ssldirs
57- RUN mkdir -p ${INSTALL_DIR}/bref/ssl && curl -Lk -o ${CA_BUNDLE} ${CA_BUNDLE_SOURCE}
58-
59-
6030RUN <<'END' bash -e
6131 export php_version=$(php-config --version | cut -c -3)
32+ # Resolve the latest stable release when no version is pinned
33+ if [ -z "$RELAY_VERSION" ]; then
34+ RELAY_VERSION=$(curl -sSL "https://builds.r2.relay.so/meta/latest" | sed 's/^v//' )
35+ fi
36+ # Relay's arch suffix: x86_64 -> x86-64, aarch64 stays aarch64
37+ ARCH=$(uname -m | sed 's/_/-/' )
38+ # el9 build links the system OpenSSL 3 / glibc from Amazon Linux 2023
6239 mkdir -p /tmp/relay
63- 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
40+ 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
6441 sed -i "s/00000000-0000-0000-0000-000000000000/$(cat /proc/sys/kernel/random/uuid)/" /tmp/relay/relay-pkg.so
6542 cp /tmp/relay/relay-pkg.so /tmp/relay.so
6643 echo 'extension=relay.so' > /tmp/ext-relay.ini
0 commit comments