Skip to content

Instantly share code, notes, and snippets.

@michael-grunder
Created October 26, 2022 21:45
Show Gist options
  • Save michael-grunder/1901bb57f07008cb4904a148d97c4b9d to your computer and use it in GitHub Desktop.
Save michael-grunder/1901bb57f07008cb4904a148d97c4b9d to your computer and use it in GitHub Desktop.
Install PHP 8.0 and Relay on vanilla RockyLinux 8
FROM rockylinux:8 as build0
RUN yum -y update && yum -y install gcc make autoconf gcc-c++ git wget libzstd-devel libxml2-devel \
sqlite-devel
FROM build0 as build1
# Download build and install PHP 8.0
RUN mkdir -p /root/dev && cd /root/dev/ && \
cd /root/dev/ && wget -q "https://www.php.net/distributions/php-8.0.14.tar.gz" && \
tar -xf "php-8.0.14.tar.gz" && mv php-8.0.14 php80 && \
cd /root/dev/php80 && \
./buildconf --force && ./configure && make -j$(nproc) install
FROM build1 as build2
# Download, build, and install igbinary, msgpack, and lz4.
# NOTE: You probably don't need to do this since you've already got them installed.
# I just included it for completeness.
RUN cd /root/dev/ && \
git clone --depth 1 --branch 3.2.6 https://github.com/igbinary/igbinary && \
cd igbinary && phpize && ./configure && make -j$(nproc) install && \
echo "extension=igbinary.so" >> $(php-config --ini-path)/php.ini && \
cd /root/dev && \
git clone --depth 1 --branch msgpack-2.1.2 https://github.com/msgpack/msgpack-php msgpack && \
cd msgpack && phpize && ./configure && make -j$(nproc) install && \
echo "extension=msgpack.so" >> $(php-config --ini-path)/php.ini && \
cd /root/dev && \
git clone --recursive --depth=1 https://github.com/kjdev/php-ext-lz4.git lz4 && \
cd lz4 && phpize && ./configure && make -j$(nproc) install && \
echo "extension=lz4.so" >> $(php-config --ini-path)/php.ini
FROM build2 as build3
ARG RELAY_VERSION="0.4.6"
ARG RELAY_WGET_PATH="https://cachewerk.s3.amazonaws.com/relay/v${RELAY_VERSION}"
ARG RELAY_WGET_FILE="relay-v${RELAY_VERSION}-php8.0-centos8-x86-64"
# Download and install relay 0.4.6, then inject a unique binary ID
RUN mkdir /root/dev/relay && cd /root/dev/relay && \
wget "${RELAY_WGET_PATH}/${RELAY_WGET_FILE}.tar.gz" && tar -xf "${RELAY_WGET_FILE}.tar.gz" && \
cd "${RELAY_WGET_FILE}" && cp relay-pkg.so $(php-config --extension-dir)/relay.so && \
sed -i "s/00000000-0000-0000-0000-000000000000/$(cat /proc/sys/kernel/random/uuid)/" "$(php-config --extension-dir)/relay.so" && \
echo "extension=relay.so" >> $(php-config --ini-path)/php.ini
FROM build3 as build4
RUN php --ri relay
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment