diff --git a/php/Dockerfile b/php/Dockerfile index 914c860..822ab37 100644 --- a/php/Dockerfile +++ b/php/Dockerfile @@ -2,23 +2,35 @@ FROM debian:bookworm-slim LABEL org.opencontainers.image.source="https://github.com/tideways/container-images" -RUN set -eux; \ - export DEBIAN_FRONTEND="noninteractive"; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - ca-certificates \ - ; \ - rm -rf /var/lib/apt/lists/* - -COPY tideways.asc /usr/share/keyrings/tideways.asc +COPY --chmod=0755 get-ext-path.php /tideways/ ENV TIDEWAYS_PHP_VERSION 5.9.0 +ENV TIDEWAYS_PHP_SHA256_X64 cbadbc49558ece142ec431b3c1291c5374e081c25345877f31aedcb9ee2e78f6 +ENV TIDEWAYS_PHP_SHA256_ARM64 42f76a2ecb2f9f545570e81c8623d0cf2e72e78a6b0b90a434cbeaba6c9a5227 RUN set -eux; \ export DEBIAN_FRONTEND="noninteractive"; \ - echo 'deb [signed-by=/usr/share/keyrings/tideways.asc] https://packages.tideways.com/apt-packages-main any-version main' |tee /etc/apt/sources.list.d/tideways.list; \ + buildDeps='curl ca-certificates'; \ apt-get update; \ - apt-get install -y \ - tideways-php=$TIDEWAYS_PHP_VERSION \ + apt-get install -y --no-install-recommends \ + $buildDeps \ ; \ - rm -rf /var/lib/apt/lists/* + \ + dpkgArch="$(dpkg --print-architecture)"; \ + case "$dpkgArch" in \ + arm64) arch='arm64' checksum="$TIDEWAYS_PHP_SHA256_ARM64" ;; \ + amd64) arch='x86_64' checksum="$TIDEWAYS_PHP_SHA256_X64" ;; \ + *) echo >&2 "error: unsupported architecture: $dpkgArch"; exit 1 ;; \ + esac; \ + \ + curl -fsSL "https://tideways.s3.amazonaws.com/extension/${TIDEWAYS_PHP_VERSION}/tideways-php-${TIDEWAYS_PHP_VERSION}-${arch}.tar.gz" -o tideways-php.tar.gz; \ + echo "$checksum *tideways-php.tar.gz" |sha256sum -c; \ + mkdir -p /tmp/tideways/; \ + tar xvf tideways-php.tar.gz --strip-components=1 -C /tmp/tideways/; \ + cp /tmp/tideways/*.so /tideways/; \ + \ + rm -r /tmp/tideways/; \ + rm tideways-php.tar.gz; \ + apt-get purge -y --auto-remove \ + $buildDeps; \ + rm -rf /var/lib/apt/lists/*; diff --git a/php/alpine/Dockerfile b/php/alpine/Dockerfile index 81c8801..b8c7d4b 100644 --- a/php/alpine/Dockerfile +++ b/php/alpine/Dockerfile @@ -2,6 +2,8 @@ FROM alpine:3.19 LABEL org.opencontainers.image.source="https://github.com/tideways/container-images" +COPY --chmod=0755 get-ext-path.php /tideways/ + ENV TIDEWAYS_PHP_VERSION 5.9.0 ENV TIDEWAYS_PHP_SHA256_X64 7fcec20e09c1b6753d949c5159a03b21249220d333725d82a0758061479fe22c ENV TIDEWAYS_PHP_SHA256_ARM64 2bbf1214215c9b3d1e589ef87371ad3a17465702f014a311be56ad23f384eab7 @@ -10,15 +12,20 @@ RUN set -eux; \ apk add --no-cache --virtual .build-deps \ curl \ ; \ + \ apkArch="$(apk --print-arch)"; \ case "$apkArch" in \ aarch64) arch='arm64' checksum="$TIDEWAYS_PHP_SHA256_ARM64" ;; \ x86_64) arch='x86_64' checksum="$TIDEWAYS_PHP_SHA256_X64" ;; \ *) echo >&2 "error: unsupported architecture: $apkArch"; exit 1 ;; \ esac; \ + \ curl -fsSL "https://tideways.s3.amazonaws.com/extension/${TIDEWAYS_PHP_VERSION}/tideways-php-${TIDEWAYS_PHP_VERSION}-alpine-${arch}.tar.gz" -o tideways-php-alpine.tar.gz; \ echo "$checksum *tideways-php-alpine.tar.gz" |sha256sum -c; \ - mkdir -p /usr/lib/tideways/; \ - tar xvf tideways-php-alpine.tar.gz --strip-components=1 -C /usr/lib/tideways/; \ + mkdir -p /tmp/tideways/; \ + tar xvf tideways-php-alpine.tar.gz --strip-components=1 -C /tmp/tideways/; \ + cp /tmp/tideways/*.so /tideways/; \ + \ + rm -r /tmp/tideways/; \ rm tideways-php-alpine.tar.gz; \ apk del --no-network .build-deps; diff --git a/php/alpine/get-ext-path.php b/php/alpine/get-ext-path.php new file mode 100644 index 0000000..02b5920 --- /dev/null +++ b/php/alpine/get-ext-path.php @@ -0,0 +1,18 @@ +#!/usr/bin/env php + php/Dockerfile.new