Skip to content

Commit

Permalink
Detect the PHP version for the al2023 docker build. (#95)
Browse files Browse the repository at this point in the history
* Detect the PHP version for the al2023 docker build.

* detect more php versions

---------

Co-authored-by: Till Krüss <till@kruss.io>
  • Loading branch information
michael-grunder and tillkruss authored Jul 19, 2023
1 parent 34d913d commit 40132f2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
11 changes: 6 additions & 5 deletions docker/al2.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ RUN pecl install igbinary && \
ARG RELAY=v0.6.6

# Download Relay
RUN PLATFORM=$(uname -m | sed 's/_/-/') \
&& curl -L "https://builds.r2.relay.so/$RELAY/relay-$RELAY-php8.0-centos7-$PLATFORM.tar.gz" | tar xz -C /tmp
RUN ARCH=$(uname -m | sed 's/_/-/') \
PHP=$(php -r 'echo substr(PHP_VERSION, 0, 3);') \
&& curl -L "https://builds.r2.relay.so/$RELAY/relay-$RELAY-php$PHP-centos7-$ARCH.tar.gz" | tar xz -C /tmp

# Copy relay.{so,ini}
RUN PLATFORM=$(uname -m | sed 's/_/-/') \
&& cp "/tmp/relay-$RELAY-php8.0-centos7-$PLATFORM/relay.ini" $(php-config --ini-dir)/50-relay.ini \
&& cp "/tmp/relay-$RELAY-php8.0-centos7-$PLATFORM/relay-pkg.so" $(php-config --extension-dir)/relay.so
RUN ARCH=$(uname -m | sed 's/_/-/') \
&& cp "/tmp/relay-$RELAY-php8.0-centos7-$ARCH/relay.ini" $(php-config --ini-dir)/50-relay.ini \
&& cp "/tmp/relay-$RELAY-php8.0-centos7-$ARCH/relay-pkg.so" $(php-config --extension-dir)/relay.so

# Inject UUID
RUN sed -i "s/00000000-0000-0000-0000-000000000000/$(cat /proc/sys/kernel/random/uuid)/" $(php-config --extension-dir)/relay.so
3 changes: 2 additions & 1 deletion docker/al2023.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ RUN pecl install igbinary && \
ARG RELAY=v0.6.6

RUN ARCH=$(uname -m | sed 's/_/-/') \
ARTIFACT="https://builds.r2.relay.so/$RELAY/relay-$RELAY-php8.1-el9-$ARCH.tar.gz" \
PHP=$(php -r 'echo substr(PHP_VERSION, 0, 3);') \
ARTIFACT="https://builds.r2.relay.so/$RELAY/relay-$RELAY-php$PHP-el9-$ARCH.tar.gz" \
&& curl -sfSL $ARTIFACT | tar xz --strip-components=1 -C /tmp

# Copy relay.{so,ini}
Expand Down
3 changes: 2 additions & 1 deletion docker/el9/el9.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ RUN dnf -y install \

# Download Relay
RUN ARCH=$(uname -m | sed 's/_/-/') \
ARTIFACT="https://builds.r2.relay.so/$RELAY/relay-$RELAY-php8.2-el9-$ARCH.tar.gz" \
PHP=$(php -r 'echo substr(PHP_VERSION, 0, 3);') \
ARTIFACT="https://builds.r2.relay.so/$RELAY/relay-$RELAY-php$PHP-el9-$ARCH.tar.gz" \
&& curl -L $ARTIFACT | tar -xz --strip-components=1 -C /tmp

# Copy relay.{so,ini}
Expand Down
11 changes: 6 additions & 5 deletions docker/ubuntu/ubuntu20.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ RUN apt-get install -y \
ARG RELAY=v0.6.6

# Download Relay
RUN PLATFORM=$(uname -m | sed 's/_/-/') \
&& curl -L "https://builds.r2.relay.so/$RELAY/relay-$RELAY-php7.4-debian-$PLATFORM.tar.gz" | tar xz -C /tmp
RUN ARCH=$(uname -m | sed 's/_/-/') \
PHP=$(php -r 'echo substr(PHP_VERSION, 0, 3);') \
&& curl -L "https://builds.r2.relay.so/$RELAY/relay-$RELAY-php$PHP-debian-$ARCH.tar.gz" | tar xz -C /tmp

# Copy relay.{so,ini}
RUN PLATFORM=$(uname -m | sed 's/_/-/') \
&& cp "/tmp/relay-$RELAY-php7.4-debian-$PLATFORM/relay.ini" $(php-config --ini-dir)/30-relay.ini \
&& cp "/tmp/relay-$RELAY-php7.4-debian-$PLATFORM/relay-pkg.so" $(php-config --extension-dir)/relay.so
RUN ARCH=$(uname -m | sed 's/_/-/') \
&& cp "/tmp/relay-$RELAY-php7.4-debian-$ARCH/relay.ini" $(php-config --ini-dir)/30-relay.ini \
&& cp "/tmp/relay-$RELAY-php7.4-debian-$ARCH/relay-pkg.so" $(php-config --extension-dir)/relay.so

# Inject UUID
RUN sed -i "s/00000000-0000-0000-0000-000000000000/$(cat /proc/sys/kernel/random/uuid)/" $(php-config --extension-dir)/relay.so

0 comments on commit 40132f2

Please sign in to comment.