@@ -63,7 +63,6 @@ RUN set -eux \
6363bisonc++ \
6464ca-certificates \
6565curl \
66- unzip \
6766dpkg-dev \
6867file \
6968flex \
@@ -419,41 +418,35 @@ RUN set -eux \
419418
420419# -------------------- Installing PHP Extension: oci8 --------------------
421420RUN set -eux \
421+ # Generic pre-command
422422&& ARCH="$(dpkg-architecture --query DEB_HOST_GNU_CPU)" \
423- && if [ "$ARCH" = "x86_64" ]; then \
424- CLIENT_URL="https://download.oracle.com/otn_software/linux/instantclient/1929000/instantclient-basic-linux.x64-19.29.0.0.0dbru.zip" \
425- && CLIENT_FILE="instantclient-basic-linux.x64-19.29.0.0.0dbru.zip" \
426- && SDK_URL="https://download.oracle.com/otn_software/linux/instantclient/1929000/instantclient-sdk-linux.x64-19.29.0.0.0dbru.zip" \
427- && SDK_FILE="instantclient-sdk-linux.x64-19.29.0.0.0dbru.zip" ; \
428- elif [ "$ARCH" = "aarch64" ]; then \
429- CLIENT_URL="https://download.oracle.com/otn_software/linux/instantclient/1928000/instantclient-basic-linux.arm64-19.28.0.0.0dbru.zip" \
430- && CLIENT_FILE="instantclient-basic-linux.arm64-19.28.0.0.0dbru.zip" \
431- && SDK_URL="https://download.oracle.com/otn_software/linux/instantclient/1928000/instantclient-sdk-linux.arm64-19.28.0.0.0dbru.zip" \
432- && SDK_FILE="instantclient-sdk-linux.arm64-19.28.0.0.0dbru.zip" ; \
433- else \
434- echo "Unsupported architecture: $ARCH" \
435- && exit 1; \
436- fi \
437- \
438- # 下载 Oracle Instant Client
439- && curl -fL -o /tmp/$CLIENT_FILE $CLIENT_URL \
440- && curl -fL -o /tmp/$SDK_FILE $SDK_URL \
441- \
442- # 解压到 /usr/local
443- && unzip -q -o /tmp/$CLIENT_FILE -d /usr/local/ \
444- && unzip -q -o /tmp/$SDK_FILE -d /usr/local/ \
445- \
446- # 创建符号链接(根据实际解压的目录名)
447- && ORACLE_DIR=$(find /usr/local -maxdepth 1 -name "instantclient_*" -type d | head -1) \
448- && mv $ORACLE_DIR /usr/local/instantclient \
449- \
450- # 配置库路径
451- && echo /usr/local/instantclient > /etc/ld.so.conf.d/oracle-instantclient.conf \
452- && ldconfig \
453- \
454- # 清理临时文件
455- && rm -f /tmp/instantclient-*.zip \
456- \
423+ && ORACLE_HREF="$( \
424+ curl -sS https://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/${ARCH}/ \
425+ | tac \
426+ | tac \
427+ | grep -Eo 'href=" getPackage/oracle-instantclient.+basiclite.+rpm"' \
428+ | grep -v " 19.10.0.0.0-2" \
429+ | tail -1 \
430+ )" \
431+ && ORACLE_VERSION_MAJOR="$( echo " ${ORACLE_HREF}" | grep -Eo 'instantclient[.0-9]+' | sed 's/instantclient//g' )" \
432+ && ORACLE_VERSION_FULL="$( echo " ${ORACLE_HREF}" | grep -Eo 'basiclite-[-.0-9]+' | sed -e 's/basiclite-//g' -e 's/\. $//g' )" \
433+ \
434+ && rpm --import http://yum.oracle.com/RPM-GPG-KEY-oracle-ol7 \
435+ && curl -sS -o /tmp/oracle-instantclient${ORACLE_VERSION_MAJOR}-basiclite-${ORACLE_VERSION_FULL}.${ARCH}.rpm \
436+ https://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/${ARCH}/getPackage/oracle-instantclient${ORACLE_VERSION_MAJOR}-basiclite-${ORACLE_VERSION_FULL}.${ARCH}.rpm \
437+ && curl -sS -o /tmp/oracle-instantclient${ORACLE_VERSION_MAJOR}-devel-${ORACLE_VERSION_FULL}.${ARCH}.rpm \
438+ https://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/${ARCH}/getPackage/oracle-instantclient${ORACLE_VERSION_MAJOR}-devel-${ORACLE_VERSION_FULL}.${ARCH}.rpm \
439+ && alien \
440+ -v \
441+ --target=$( dpkg --print-architecture ) \
442+ -i /tmp/oracle-instantclient${ORACLE_VERSION_MAJOR}-basiclite-${ORACLE_VERSION_FULL}.${ARCH}.rpm \
443+ && alien \
444+ -v \
445+ --target=$( dpkg --print-architecture ) \
446+ -i /tmp/oracle-instantclient${ORACLE_VERSION_MAJOR}-devel-${ORACLE_VERSION_FULL}.${ARCH}.rpm \
447+ && rm -f /tmp/oracle-instantclient${ORACLE_VERSION_MAJOR}-basiclite-${ORACLE_VERSION_FULL}.${ARCH}.rpm \
448+ && rm -f /tmp/oracle-instantclient${ORACLE_VERSION_MAJOR}-devel-${ORACLE_VERSION_FULL}.${ARCH}.rpm \
449+ \
457450# Installation: Version specific
458451# Type: GIT extension
459452&& git clone https://github.com/php/pecl-database-oci8 /tmp/pecl-database-oci8 \
@@ -462,10 +455,24 @@ RUN set -eux \
462455&& git checkout $(git tag | grep -E 'v[.0-9]+$' | sort -V | tail -1) \
463456# Default: Install command
464457&& phpize \
465- && ./configure --with-oci8=instantclient,/usr/local/instantclient \
458+ && ./configure --with-oci8=instantclient,/usr/lib/oracle/${ORACLE_VERSION_MAJOR}/client64/lib/,${ORACLE_VERSION_MAJOR} \
466459&& make -j$(getconf _NPROCESSORS_ONLN) \
467460&& make install \
468461&& cd /tmp && rm -rf /tmp/pecl-database-oci8 \
462+ # Generic post-command
463+ && ARCH="$(dpkg-architecture --query DEB_HOST_GNU_CPU)" \
464+ && ORACLE_HREF="$( \
465+ curl -sS https://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/${ARCH}/ \
466+ | tac \
467+ | tac \
468+ | grep -Eo 'href=" getPackage/oracle-instantclient.+basiclite.+rpm"' \
469+ | grep -v " 19.10.0.0.0-2" \
470+ | tail -1 \
471+ )" \
472+ && ORACLE_VERSION_MAJOR="$( echo " ${ORACLE_HREF}" | grep -Eo 'instantclient[.0-9]+' | sed 's/instantclient//g' )" \
473+ && ORACLE_VERSION_FULL="$( echo " ${ORACLE_HREF}" | grep -Eo 'basiclite-[-.0-9]+' | sed -e 's/basiclite-//g' -e 's/\. $//g' )" \
474+ && (ln -sf /usr/lib/oracle/${ORACLE_VERSION_MAJOR}/client64/lib/*.so* /usr/lib/ || true) \
475+ \
469476# Enabling
470477&& docker-php-ext-enable oci8 \
471478&& true
@@ -519,49 +526,43 @@ RUN set -eux \
519526
520527# -------------------- Installing PHP Extension: pdo_oci --------------------
521528RUN set -eux \
529+ # Generic pre-command
522530&& ARCH="$(dpkg-architecture --query DEB_HOST_GNU_CPU)" \
523- && if [ "$ARCH" = "x86_64" ]; then \
524- CLIENT_URL="https://download.oracle.com/otn_software/linux/instantclient/1929000/instantclient-basic-linux.x64-19.29.0.0.0dbru.zip" \
525- && CLIENT_FILE="instantclient-basic-linux.x64-19.29.0.0.0dbru.zip" \
526- && SDK_URL="https://download.oracle.com/otn_software/linux/instantclient/1929000/instantclient-sdk-linux.x64-19.29.0.0.0dbru.zip" \
527- && SDK_FILE="instantclient-sdk-linux.x64-19.29.0.0.0dbru.zip" ; \
528- elif [ "$ARCH" = "aarch64" ]; then \
529- CLIENT_URL="https://download.oracle.com/otn_software/linux/instantclient/1928000/instantclient-basic-linux.arm64-19.28.0.0.0dbru.zip" \
530- && CLIENT_FILE="instantclient-basic-linux.arm64-19.28.0.0.0dbru.zip" \
531- && SDK_URL="https://download.oracle.com/otn_software/linux/instantclient/1928000/instantclient-sdk-linux.arm64-19.28.0.0.0dbru.zip" \
532- && SDK_FILE="instantclient-sdk-linux.arm64-19.28.0.0.0dbru.zip" ; \
533- else \
534- echo "Unsupported architecture: $ARCH" \
535- && exit 1; \
536- fi \
537- \
538- # 下载 Oracle Instant Client
539- && curl -fL -o /tmp/$CLIENT_FILE $CLIENT_URL \
540- && curl -fL -o /tmp/$SDK_FILE $SDK_URL \
541- \
542- # 解压到 /usr/local
543- && unzip -q -o /tmp/$CLIENT_FILE -d /usr/local/ \
544- && unzip -q -o /tmp/$SDK_FILE -d /usr/local/ \
545- \
546- # 创建符号链接(根据实际解压的目录名)
547- && ORACLE_DIR=$(find /usr/local -maxdepth 1 -name "instantclient_*" -type d | head -1) \
548- && mv $ORACLE_DIR /usr/local/instantclient \
549- \
550- # 配置库路径
551- && echo /usr/local/instantclient > /etc/ld.so.conf.d/oracle-instantclient.conf \
552- && ldconfig \
553- \
554- # 清理临时文件
555- && rm -f /tmp/instantclient-*.zip \
556- \
531+ && ORACLE_HREF="$( \
532+ curl -sS https://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/${ARCH}/ \
533+ | tac \
534+ | tac \
535+ | grep -Eo 'href=" getPackage/oracle-instantclient.+basiclite.+rpm"' \
536+ | grep -v " 19.10.0.0.0-2" \
537+ | tail -1 \
538+ )" \
539+ && ORACLE_VERSION_MAJOR="$( echo " ${ORACLE_HREF}" | grep -Eo 'instantclient[.0-9]+' | sed 's/instantclient//g' )" \
540+ && ORACLE_VERSION_FULL="$( echo " ${ORACLE_HREF}" | grep -Eo 'basiclite-[-.0-9]+' | sed -e 's/basiclite-//g' -e 's/\. $//g' )" \
541+ \
542+ && rpm --import http://yum.oracle.com/RPM-GPG-KEY-oracle-ol7 \
543+ && curl -sS -o /tmp/oracle-instantclient${ORACLE_VERSION_MAJOR}-basiclite-${ORACLE_VERSION_FULL}.${ARCH}.rpm \
544+ https://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/${ARCH}/getPackage/oracle-instantclient${ORACLE_VERSION_MAJOR}-basiclite-${ORACLE_VERSION_FULL}.${ARCH}.rpm \
545+ && curl -sS -o /tmp/oracle-instantclient${ORACLE_VERSION_MAJOR}-devel-${ORACLE_VERSION_FULL}.${ARCH}.rpm \
546+ https://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/${ARCH}/getPackage/oracle-instantclient${ORACLE_VERSION_MAJOR}-devel-${ORACLE_VERSION_FULL}.${ARCH}.rpm \
547+ && alien \
548+ -v \
549+ --target=$( dpkg --print-architecture ) \
550+ -i /tmp/oracle-instantclient${ORACLE_VERSION_MAJOR}-basiclite-${ORACLE_VERSION_FULL}.${ARCH}.rpm \
551+ && alien \
552+ -v \
553+ --target=$( dpkg --print-architecture ) \
554+ -i /tmp/oracle-instantclient${ORACLE_VERSION_MAJOR}-devel-${ORACLE_VERSION_FULL}.${ARCH}.rpm \
555+ && rm -f /tmp/oracle-instantclient${ORACLE_VERSION_MAJOR}-basiclite-${ORACLE_VERSION_FULL}.${ARCH}.rpm \
556+ && rm -f /tmp/oracle-instantclient${ORACLE_VERSION_MAJOR}-devel-${ORACLE_VERSION_FULL}.${ARCH}.rpm \
557+ && (ln -s /usr/lib/oracle/${ORACLE_VERSION_MAJOR}/client64/lib/*.so* /usr/lib/ || true) \
558+ \
557559# Installation: Version specific
558560# Type: GIT extension
559- # && git clone https://github.com/php/pecl-database-pdo_oci /tmp/pecl-database-pdo_oci \
560- && git clone https://github.com/wantedxnn/pecl-database-pdo_oci /tmp/pecl-database-pdo_oci \
561+ && git clone https://github.com/php/pecl-database-pdo_oci /tmp/pecl-database-pdo_oci \
561562&& cd /tmp/pecl-database-pdo_oci \
562563# Default: Install command
563564&& phpize \
564- && ./configure --with-pdo-oci=instantclient,/usr/local/instantclient \
565+ && ./configure --with-pdo-oci=instantclient,/usr/lib/oracle/${ORACLE_VERSION_MAJOR}/client64/lib/,${ORACLE_VERSION_MAJOR} \
565566&& make -j$(getconf _NPROCESSORS_ONLN) \
566567&& make install \
567568&& cd /tmp && rm -rf /tmp/pecl-database-pdo_oci \
@@ -927,7 +928,7 @@ RUN set -eux \
927928
928929# Fix oracle dir for images that don't have oci installed
929930RUN set -eux \
930- && mkdir -p /usr/local/instantclient /
931+ && mkdir -p /usr/lib/oracle /
931932
932933# Shrink everything down
933934RUN set -eux \
@@ -996,7 +997,7 @@ COPY --from=builder ${EXT_DIR}/ ${EXT_DIR}/
996997COPY --from=builder /usr/local/etc/php/conf.d/ /usr/local/etc/php/conf.d/
997998COPY --from=builder /usr/local/bin/ /usr/local/bin/
998999COPY --from=builder /usr/local/lib/ /usr/local/lib/
999- COPY --from=builder /usr/local/instantclient / /usr/local/instantclient /
1000+ COPY --from=builder /usr/lib/oracle / /usr/lib/oracle /
10001001
10011002
10021003# ##
@@ -1013,6 +1014,20 @@ RUN set -eux \
10131014&& sed -i'' 's|.*<policy domain="coder".*"XPS".*||g' /etc/ImageMagick-7/policy.xml \
10141015&& sed -i'' 's|.*<policy domain="coder".*"PS".*||g' /etc/ImageMagick-7/policy.xml \
10151016&& sed -i'' 's|.*<policy domain="delegate".*pattern="gs".*||g' /etc/ImageMagick-7/policy.xml \
1017+ \
1018+ # ---------- oci8 ----------
1019+ && ARCH="$(dpkg-architecture --query DEB_HOST_GNU_CPU)" \
1020+ && ORACLE_HREF="$( \
1021+ curl -sS https://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/${ARCH}/ \
1022+ | tac \
1023+ | tac \
1024+ | grep -Eo 'href=" getPackage/oracle-instantclient.+basiclite.+rpm"' \
1025+ | grep -v " 19.10.0.0.0-2" \
1026+ | tail -1 \
1027+ )" \
1028+ && ORACLE_VERSION_MAJOR="$( echo " ${ORACLE_HREF}" | grep -Eo 'instantclient[.0-9]+' | sed 's/instantclient//g' )" \
1029+ && ORACLE_VERSION_FULL="$( echo " ${ORACLE_HREF}" | grep -Eo 'basiclite-[-.0-9]+' | sed -e 's/basiclite-//g' -e 's/\. $//g' )" \
1030+ && (ln -sf /usr/lib/oracle/${ORACLE_VERSION_MAJOR}/client64/lib/*.so* /usr/lib/ || true) \
10161031 \
10171032&& true
10181033
0 commit comments