diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6a4d328b97502db8940e33df071e0c06260da0ca..5fb83e84958ca3e78af3c3bca9d228efa2737c69 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,7 +9,7 @@ build5.6: script: - export HTTP_PROXY=http://10.14.128.99:3128 - export PHP_VERSION=5.6 - - docker build --rm --build-arg PHP_VERSION=${PHP_VERSION} --build-arg HTTP_PROXY=${HTTP_PROXY} --build-arg OCI8_PACKAGE="oci8-2.0.12" -t unicaen-dev-php${PHP_VERSION}-apache . + - docker build --rm --build-arg PHP_VERSION=${PHP_VERSION} --build-arg HTTP_PROXY=${HTTP_PROXY} -f Dockerfile-5.x -t unicaen-dev-php${PHP_VERSION}-apache . - docker tag unicaen-dev-php${PHP_VERSION}-apache registre.unicaen.fr:5000/unicaen-dev-php${PHP_VERSION}-apache - docker push registre.unicaen.fr:5000/unicaen-dev-php${PHP_VERSION}-apache @@ -18,7 +18,7 @@ build7.0: script: - export HTTP_PROXY=http://10.14.128.99:3128 - export PHP_VERSION=7.0 - - docker build --rm --build-arg PHP_VERSION=${PHP_VERSION} --build-arg HTTP_PROXY=${HTTP_PROXY} -t unicaen-dev-php${PHP_VERSION}-apache . + - docker build --rm --build-arg PHP_VERSION=${PHP_VERSION} --build-arg HTTP_PROXY=${HTTP_PROXY} -f Dockerfile-7.x -t unicaen-dev-php${PHP_VERSION}-apache . - docker tag unicaen-dev-php${PHP_VERSION}-apache registre.unicaen.fr:5000/unicaen-dev-php${PHP_VERSION}-apache - docker push registre.unicaen.fr:5000/unicaen-dev-php${PHP_VERSION}-apache @@ -27,7 +27,7 @@ build7.1: script: - export HTTP_PROXY=http://10.14.128.99:3128 - export PHP_VERSION=7.1 - - docker build --rm --build-arg PHP_VERSION=${PHP_VERSION} --build-arg HTTP_PROXY=${HTTP_PROXY} -t unicaen-dev-php${PHP_VERSION}-apache . + - docker build --rm --build-arg PHP_VERSION=${PHP_VERSION} --build-arg HTTP_PROXY=${HTTP_PROXY} -f Dockerfile-7.x -t unicaen-dev-php${PHP_VERSION}-apache . - docker tag unicaen-dev-php${PHP_VERSION}-apache registre.unicaen.fr:5000/unicaen-dev-php${PHP_VERSION}-apache - docker push registre.unicaen.fr:5000/unicaen-dev-php${PHP_VERSION}-apache @@ -36,7 +36,7 @@ build7.2: script: - export HTTP_PROXY=http://10.14.128.99:3128 - export PHP_VERSION=7.2 - - docker build --rm --build-arg PHP_VERSION=${PHP_VERSION} --build-arg HTTP_PROXY=${HTTP_PROXY} -t unicaen-dev-php${PHP_VERSION}-apache . + - docker build --rm --build-arg PHP_VERSION=${PHP_VERSION} --build-arg HTTP_PROXY=${HTTP_PROXY} -f Dockerfile-7.x -t unicaen-dev-php${PHP_VERSION}-apache . - docker tag unicaen-dev-php${PHP_VERSION}-apache registre.unicaen.fr:5000/unicaen-dev-php${PHP_VERSION}-apache - docker push registre.unicaen.fr:5000/unicaen-dev-php${PHP_VERSION}-apache @@ -45,10 +45,10 @@ build7.3: script: - export HTTP_PROXY=http://10.14.128.99:3128 - export PHP_VERSION=7.3 - - docker build --rm --build-arg PHP_VERSION=${PHP_VERSION} --build-arg HTTP_PROXY=${HTTP_PROXY} -t unicaen-dev-php${PHP_VERSION}-apache . + - docker build --rm --build-arg PHP_VERSION=${PHP_VERSION} --build-arg HTTP_PROXY=${HTTP_PROXY} -f Dockerfile-7.x -t unicaen-dev-php${PHP_VERSION}-apache . - docker tag unicaen-dev-php${PHP_VERSION}-apache registre.unicaen.fr:5000/unicaen-dev-php${PHP_VERSION}-apache - docker push registre.unicaen.fr:5000/unicaen-dev-php${PHP_VERSION}-apache - - docker build --rm --build-arg PHP_VERSION=${PHP_VERSION} --build-arg HTTP_PROXY=${HTTP_PROXY} -t open-source/docker/unicaen-image:php${PHP_VERSION} . + - docker build --rm --build-arg PHP_VERSION=${PHP_VERSION} --build-arg HTTP_PROXY=${HTTP_PROXY} -f Dockerfile-7.x -t open-source/docker/unicaen-image:php${PHP_VERSION} . - docker tag open-source/docker/unicaen-image:php${PHP_VERSION} registre.unicaen.fr:5000/open-source/docker/unicaen-image:php${PHP_VERSION} - docker push registre.unicaen.fr:5000/open-source/docker/unicaen-image:php${PHP_VERSION} @@ -57,9 +57,21 @@ build7.4: script: - export HTTP_PROXY=http://10.14.128.99:3128 - export PHP_VERSION=7.4 - - docker build --rm --build-arg PHP_VERSION=${PHP_VERSION} --build-arg HTTP_PROXY=${HTTP_PROXY} -t unicaen-dev-php${PHP_VERSION}-apache . + - docker build --rm --build-arg PHP_VERSION=${PHP_VERSION} --build-arg HTTP_PROXY=${HTTP_PROXY} -f Dockerfile-7.x -t unicaen-dev-php${PHP_VERSION}-apache . - docker tag unicaen-dev-php${PHP_VERSION}-apache registre.unicaen.fr:5000/unicaen-dev-php${PHP_VERSION}-apache - docker push registre.unicaen.fr:5000/unicaen-dev-php${PHP_VERSION}-apache - - docker build --rm --build-arg PHP_VERSION=${PHP_VERSION} --build-arg HTTP_PROXY=${HTTP_PROXY} -t open-source/docker/unicaen-image:php${PHP_VERSION} . + - docker build --rm --build-arg PHP_VERSION=${PHP_VERSION} --build-arg HTTP_PROXY=${HTTP_PROXY} -f Dockerfile-7.x -t open-source/docker/unicaen-image:php${PHP_VERSION} . + - docker tag open-source/docker/unicaen-image:php${PHP_VERSION} registre.unicaen.fr:5000/open-source/docker/unicaen-image:php${PHP_VERSION} + - docker push registre.unicaen.fr:5000/open-source/docker/unicaen-image:php${PHP_VERSION} + +build8.0: + stage: build + script: + - export HTTP_PROXY=http://10.14.128.99:3128 + - export PHP_VERSION=8.0 + - docker build --rm --build-arg PHP_VERSION=${PHP_VERSION} --build-arg HTTP_PROXY=${HTTP_PROXY} -f Dockerfile-8.x -t unicaen-dev-php${PHP_VERSION}-apache . + - docker tag unicaen-dev-php${PHP_VERSION}-apache registre.unicaen.fr:5000/unicaen-dev-php${PHP_VERSION}-apache + - docker push registre.unicaen.fr:5000/unicaen-dev-php${PHP_VERSION}-apache + - docker build --rm --build-arg PHP_VERSION=${PHP_VERSION} --build-arg HTTP_PROXY=${HTTP_PROXY} -f Dockerfile-8.x -t open-source/docker/unicaen-image:php${PHP_VERSION} . - docker tag open-source/docker/unicaen-image:php${PHP_VERSION} registre.unicaen.fr:5000/open-source/docker/unicaen-image:php${PHP_VERSION} - docker push registre.unicaen.fr:5000/open-source/docker/unicaen-image:php${PHP_VERSION} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..19c7b20d479570b3d540a7fe9da381e5a361de59 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +# CHANGELOG + +## 1.0.0 + +- Un Dockerfile par version majeure de PHP car les versions du driver Oracle OCI8 et Instant Client diffèrent. diff --git a/Dockerfile b/Dockerfile-5.x similarity index 97% rename from Dockerfile rename to Dockerfile-5.x index 452a99380615863a97e0972be12a52d6899566dc..b9eb12315a1a4fcb7831d105eb21786136a7922c 100644 --- a/Dockerfile +++ b/Dockerfile-5.x @@ -4,16 +4,15 @@ # ########################################################################################### -FROM debian:stretch +FROM debian:stretch as distrib #FROM localhost:5000/stretch LABEL maintainer="Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>" ARG PHP_VERSION -ARG OCI8_PACKAGE -#ARG http_proxy ENV PHP_VERSION=${PHP_VERSION} \ + OCI8_PACKAGE="oci8-2.0.12" \ APACHE_CONF_DIR=/etc/apache2 \ PHP_CONF_DIR=/etc/php/${PHP_VERSION} @@ -29,6 +28,9 @@ RUN apt-get install -y wget lsb-release apt-transport-https ca-certificates && \ wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg && \ echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list + +FROM distrib + # Installation des packages communs RUN apt-get -qq update && \ apt-get install -y \ @@ -117,9 +119,8 @@ ADD configs/apache/security.conf ${APACHE_CONF_DIR}/conf-available/security-unic RUN a2disconf security.conf && \ a2enconf security-unicaen.conf php${PHP_VERSION}-fpm -# Composer -RUN curl -sS https://getcomposer.org/installer --proxy "${http_proxy}" | php -- --install-dir=/usr/local/bin --filename=composer && \ - composer global require hirak/prestissimo --no-plugins --no-scripts +# Composer 2.x (plus besoin de hirak/prestissimo depuis la 2.x) +RUN curl -sS https://getcomposer.org/installer --proxy "${http_proxy}" | php -- --install-dir=/usr/local/bin --filename=composer # Nettoyage RUN apt-get autoremove -y && apt-get clean && rm -rf /tmp/* /var/tmp/* diff --git a/Dockerfile.sh b/Dockerfile-5.x.sh similarity index 95% rename from Dockerfile.sh rename to Dockerfile-5.x.sh index 93ae09930e1ac260d777adb19d6dcb09e16ad908..5112bed22d014ddf0c6ba3b7e2cebc891353ae5e 100755 --- a/Dockerfile.sh +++ b/Dockerfile-5.x.sh @@ -19,6 +19,7 @@ EOF ################################################################################################################ export PHP_VERSION="$1" +export OCI8_PACKAGE="oci8-2.0.12" export APACHE_CONF_DIR=/etc/apache2 export PHP_CONF_DIR=/etc/php/${PHP_VERSION} @@ -113,7 +114,7 @@ unzip -o /tmp/instantclient-sqlplus-linux.x64-12.2.0.1.0.zip -d /usr/local/ && \ ln -s /usr/local/instantclient_12_2 /usr/local/instantclient && \ ln -s /usr/local/instantclient/libclntsh.so.12.1 /usr/local/instantclient/libclntsh.so && \ ln -s /usr/local/instantclient/sqlplus /usr/local/bin/sqlplus && \ -echo 'instantclient,/usr/local/instantclient' | pecl install oci8 && \ +echo 'instantclient,/usr/local/instantclient' | pecl install ${OCI8_PACKAGE} && \ echo "extension=oci8.so" > ${PHP_CONF_DIR}/fpm/conf.d/30-php-oci8.ini && \ echo "extension=oci8.so" > ${PHP_CONF_DIR}/cli/conf.d/30-php-oci8.ini && \ echo "/usr/local/instantclient" > /etc/ld.so.conf.d/oracle-instantclient.conf && ldconfig @@ -124,9 +125,8 @@ cp configs/apache/security.conf ${APACHE_CONF_DIR}/conf-available/security-unica a2disconf security.conf && \ a2enconf security-unicaen.conf php${PHP_VERSION}-fpm -# Composer -curl -sS https://getcomposer.org/installer --proxy "${http_proxy}" | php -- --install-dir=/usr/local/bin --filename=composer && \ -composer global require hirak/prestissimo --no-plugins --no-scripts +# Composer 2.x (plus besoin de hirak/prestissimo depuis la 2.x) +curl -sS https://getcomposer.org/installer --proxy "${http_proxy}" | php -- --install-dir=/usr/local/bin --filename=composer # Nettoyage apt autoremove -y && apt clean diff --git a/Dockerfile7.3+ b/Dockerfile-7.x similarity index 97% rename from Dockerfile7.3+ rename to Dockerfile-7.x index 5151003cff6692c20147d25113a98335d911d10f..231b58fc83515e4f42202ac88b15aacc1a3fc986 100644 --- a/Dockerfile7.3+ +++ b/Dockerfile-7.x @@ -13,15 +13,15 @@ # --build-arg no_proxy # -FROM debian:stretch +FROM debian:stretch as distrib #FROM localhost:5000/stretch LABEL maintainer="Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>" ARG PHP_VERSION -ARG OCI8_PACKAGE ENV PHP_VERSION=${PHP_VERSION} \ + OCI8_PACKAGE="oci8-2.2.0" \ APACHE_CONF_DIR=/etc/apache2 \ PHP_CONF_DIR=/etc/php/${PHP_VERSION} @@ -37,6 +37,9 @@ RUN apt-get install -y wget lsb-release apt-transport-https ca-certificates && \ wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg && \ echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list + +FROM distrib + # Installation des packages communs RUN apt-get -qq update && \ apt-get install -y \ @@ -124,9 +127,8 @@ ADD configs/apache/security.conf ${APACHE_CONF_DIR}/conf-available/security-unic RUN a2disconf security.conf && \ a2enconf security-unicaen.conf php${PHP_VERSION}-fpm -# Composer -RUN curl -sS https://getcomposer.org/installer --proxy "${http_proxy}" | php -- --install-dir=/usr/local/bin --filename=composer && \ - composer global require hirak/prestissimo --no-plugins --no-scripts +# Composer 2.x (plus besoin de hirak/prestissimo depuis la 2.x) +RUN curl -sS https://getcomposer.org/installer --proxy "${http_proxy}" | php -- --install-dir=/usr/local/bin --filename=composer # Nettoyage RUN apt-get autoremove -y && apt-get clean && rm -rf /tmp/* /var/tmp/* diff --git a/Dockerfile-7.x.sh b/Dockerfile-7.x.sh new file mode 100755 index 0000000000000000000000000000000000000000..b0345adff8dceee401a181ebb58b15ab437f9639 --- /dev/null +++ b/Dockerfile-7.x.sh @@ -0,0 +1,146 @@ +#!/usr/bin/env bash + +################################################################################################################ +# +# Script d'install d'un serveur, traduction du Dockerfile. +# +# PHP >= 7.0 +# +################################################################################################################ + +usage() { + cat << EOF +Script d'install d'un serveur, traduction du Dockerfile. +Usage: $0 <version de PHP> +EOF + exit 0; +} + +[[ -z "$1" ]] && usage + +################################################################################################################ + +export PHP_VERSION="$1" +export OCI8_PACKAGE="oci8-2.2.0" +export APACHE_CONF_DIR=/etc/apache2 +export PHP_CONF_DIR=/etc/php/${PHP_VERSION} + +# Mise à niveau de la distrib +echo "Acquire::http::proxy \"${HTTP_PROXY}\";" >> /etc/apt/apt.conf.d/05proxy +echo "Acquire::https::proxy \"${http_proxy}\";" >> /etc/apt/apt.conf.d/05proxy +apt -qq update && apt -y full-upgrade + +# PHP 7.x PPA repository +apt install -y wget lsb-release apt-transport-https ca-certificates +echo "http_proxy = ${HTTP_PROXY}" >> /etc/wgetrc +echo "https_proxy = ${HTTP_PROXY}" >> /etc/wgetrc +wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg +echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list +export http_proxy=${HTTP_PROXY} +export https_proxy=${HTTP_PROXY} +export ftp_proxy=${HTTP_PROXY} +export no_proxy=unicaen.fr + +# Installation des packages requis. +apt -qq update && \ + apt install -y \ + apache2 \ + ca-certificates \ + curl \ + ghostscript \ + ghostscript-x \ + git \ + ldap-utils \ + libaio1 \ + libcurl4-openssl-dev \ + libfreetype6-dev \ + libicu-dev \ + libjpeg62-turbo-dev \ + libldap2-dev \ + libmcrypt-dev \ + libmemcached-dev \ + libssl-dev \ + libxml2-dev \ + make \ + memcached \ + libmemcached-tools \ + netcat-openbsd \ + php-pear \ + php${PHP_VERSION} \ + php${PHP_VERSION}-bcmath \ + php${PHP_VERSION}-curl \ + php${PHP_VERSION}-dev \ + php${PHP_VERSION}-fpm \ + php${PHP_VERSION}-gd \ + php${PHP_VERSION}-gettext \ + php${PHP_VERSION}-iconv \ + php${PHP_VERSION}-imagick \ + php${PHP_VERSION}-intl \ + php${PHP_VERSION}-ldap \ + php${PHP_VERSION}-mbstring \ + php${PHP_VERSION}-memcached \ + php${PHP_VERSION}-mysql \ + php${PHP_VERSION}-opcache \ + php${PHP_VERSION}-pgsql \ + php${PHP_VERSION}-soap \ + php${PHP_VERSION}-xdebug \ + php${PHP_VERSION}-xml \ + php${PHP_VERSION}-zip \ + php${PHP_VERSION}-cli \ + php${PHP_VERSION}-common \ + php${PHP_VERSION}-json \ + php${PHP_VERSION}-opcache \ + php${PHP_VERSION}-readline \ + ssh \ + ssl-cert \ + subversion \ + unzip \ + vim \ + wget \ + zlib1g-dev + +# Forçage de la version de PHP CLI +update-alternatives --set php /usr/bin/php${PHP_VERSION} + +# Config PHP. +cp configs/php.conf ${PHP_CONF_DIR}/fpm/conf.d/20-php-unicaen.ini +cp configs/php-opcache.ini ${PHP_CONF_DIR}/fpm/conf.d/20-opcache-unicaen.ini + +# Package PHP Oracle OCI8 +cp resources/instantclient-basiclite-linux.x64-18.5.0.0.0dbru.zip /tmp/ +cp resources/instantclient-sdk-linux.x64-18.5.0.0.0dbru.zip /tmp/ +cp resources/instantclient-sqlplus-linux.x64-18.5.0.0.0dbru.zip /tmp/ +unzip -o /tmp/instantclient-basiclite-linux.x64-18.5.0.0.0dbru.zip -d /usr/local/ && \ +unzip -o /tmp/instantclient-sdk-linux.x64-18.5.0.0.0dbru.zip -d /usr/local/ && \ +unzip -o /tmp/instantclient-sqlplus-linux.x64-18.5.0.0.0dbru.zip -d /usr/local/ && \ +ln -sf /usr/local/instantclient_18_5 /usr/local/instantclient && \ +ln -sf /usr/local/instantclient/sqlplus /usr/local/bin/sqlplus && \ +echo 'instantclient,/usr/local/instantclient' | pecl install ${OCI8_PACKAGE} && \ +echo "extension=oci8.so" > ${PHP_CONF_DIR}/fpm/conf.d/30-php-oci8.ini && \ +echo "extension=oci8.so" > ${PHP_CONF_DIR}/cli/conf.d/30-php-oci8.ini && \ +echo "/usr/local/instantclient" > /etc/ld.so.conf.d/oracle-instantclient.conf && ldconfig + +a2enmod actions alias rewrite ssl proxy proxy_fcgi setenvif headers && \ +a2dismod mpm_event mpm_prefork && a2enmod mpm_worker +cp configs/apache/security.conf ${APACHE_CONF_DIR}/conf-available/security-unicaen.conf +a2disconf security.conf && \ +a2enconf security-unicaen.conf php${PHP_VERSION}-fpm + +# Composer 2.x (plus besoin de hirak/prestissimo depuis la 2.x) +curl -sS https://getcomposer.org/installer --proxy "${http_proxy}" | php -- --install-dir=/usr/local/bin --filename=composer + +# Nettoyage +apt autoremove -y && apt clean + +# Copie les fichiers situés dans ./entrypoint.d dans le dossier /entrypoint.d de l'image. +# Les scripts exécutables parmi eux seront exécutés au démarrage du container (cf. entrypoint.sh). +# Attention : les noms de fichiers ne doivent être constitués que de lettres minuscules ou majuscules, +# de chiffres, de tirets bas (underscore) ou de tirets ; extension interdite, donc. +mkdir -p /entrypoint.d +cp entrypoint.d/* /entrypoint.d/ + +# Entry point +cp entrypoint.sh /sbin/entrypoint.sh +chmod 755 /sbin/entrypoint.sh +export WITHOUT_DOCKER=1 +bash /sbin/entrypoint.sh diff --git a/Dockerfile-8.x b/Dockerfile-8.x new file mode 100644 index 0000000000000000000000000000000000000000..a4a55a346ad9b8cb73250429551445167f01429b --- /dev/null +++ b/Dockerfile-8.x @@ -0,0 +1,145 @@ +########################################################################################### +# +# Image Unicaen +# +# PHP >= 8.0 +# +########################################################################################### + +# +# NB: Transmission possible des éventuelles variables d'env `http_*` via `--build-arg` : +# --build-arg http_proxy +# --build-arg https_proxy +# --build-arg no_proxy +# + +FROM debian:stretch as distrib +#FROM localhost:5000/stretch + +LABEL maintainer="Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>" + +ARG PHP_VERSION + +ENV PHP_VERSION=${PHP_VERSION} \ + OCI8_PACKAGE="oci8-3.0.0" \ + APACHE_CONF_DIR=/etc/apache2 \ + PHP_CONF_DIR=/etc/php/${PHP_VERSION} + +# Mise à niveau de la distrib +RUN echo "Acquire::http::proxy \"${http_proxy}\";" >> /etc/apt/apt.conf.d/proxy && \ + echo "Acquire::https::proxy \"${http_proxy}\";" >> /etc/apt/apt.conf.d/proxy && \ + apt-get -qq update + +# Repositories fournissant PHP 5.x et 7.x +RUN apt-get install -y wget lsb-release apt-transport-https ca-certificates && \ + echo "http_proxy = ${http_proxy}" >> /etc/wgetrc && \ + echo "https_proxy = ${http_proxy}" >> /etc/wgetrc && \ + wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg && \ + echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list + + +FROM distrib + +# Installation des packages communs +RUN apt-get -qq update && \ + apt-get install -y \ + apache2 \ + ca-certificates \ + curl \ + ghostscript \ + ghostscript-x \ + git \ + ldap-utils \ + libaio1 \ + libcurl4-openssl-dev \ + libfreetype6-dev \ + libicu-dev \ + libjpeg62-turbo-dev \ + libldap2-dev \ + libmcrypt-dev \ + libmemcached-dev \ + libssl-dev \ + libxml2-dev \ + make \ + memcached \ + libmemcached-tools \ + netcat-openbsd \ + php-pear \ + php${PHP_VERSION} \ + php${PHP_VERSION}-bcmath \ + php${PHP_VERSION}-curl \ + php${PHP_VERSION}-dev \ + php${PHP_VERSION}-fpm \ + php${PHP_VERSION}-gd \ + php${PHP_VERSION}-gettext \ + php${PHP_VERSION}-iconv \ + php${PHP_VERSION}-imagick \ + php${PHP_VERSION}-intl \ + php${PHP_VERSION}-ldap \ + php${PHP_VERSION}-mbstring \ + php${PHP_VERSION}-memcached \ + php${PHP_VERSION}-mysql \ + php${PHP_VERSION}-opcache \ + php${PHP_VERSION}-pgsql \ + php${PHP_VERSION}-soap \ + php${PHP_VERSION}-xdebug \ + php${PHP_VERSION}-xml \ + php${PHP_VERSION}-zip \ + php${PHP_VERSION}-cli \ + php${PHP_VERSION}-common \ + # php${PHP_VERSION}-json \ # inutile en PHP 8 car absorbé par php-fpm notamment + php${PHP_VERSION}-opcache \ + php${PHP_VERSION}-readline \ + ssh \ + ssl-cert \ + subversion \ + unzip \ + vim \ + wget \ + zlib1g-dev + +# Forçage de la version de PHP CLI +RUN update-alternatives --set php /usr/bin/php${PHP_VERSION} + +# Config PHP +ADD configs/php.conf ${PHP_CONF_DIR}/fpm/conf.d/20-php-unicaen.ini +ADD configs/php-opcache.ini ${PHP_CONF_DIR}/fpm/conf.d/20-opcache-unicaen.ini + +# Package PHP Oracle OCI8 +RUN pear config-set http_proxy "${http_proxy}" +ADD resources/instantclient-basiclite-linux.x64-18.5.0.0.0dbru.zip /tmp/ +ADD resources/instantclient-sdk-linux.x64-18.5.0.0.0dbru.zip /tmp/ +ADD resources/instantclient-sqlplus-linux.x64-18.5.0.0.0dbru.zip /tmp/ +RUN unzip -o /tmp/instantclient-basiclite-linux.x64-18.5.0.0.0dbru.zip -d /usr/local/ && \ + unzip -o /tmp/instantclient-sdk-linux.x64-18.5.0.0.0dbru.zip -d /usr/local/ && \ + unzip -o /tmp/instantclient-sqlplus-linux.x64-18.5.0.0.0dbru.zip -d /usr/local/ && \ + ln -s /usr/local/instantclient_18_5 /usr/local/instantclient && \ + ln -s /usr/local/instantclient/sqlplus /usr/bin/sqlplus && \ + echo 'instantclient,/usr/local/instantclient' | pecl install ${OCI8_PACKAGE} && \ + echo "extension=oci8.so" > ${PHP_CONF_DIR}/fpm/conf.d/30-php-oci8.ini && \ + echo "extension=oci8.so" > ${PHP_CONF_DIR}/cli/conf.d/30-php-oci8.ini && \ + echo "/usr/local/instantclient" > /etc/ld.so.conf.d/oracle-instantclient.conf && ldconfig + +# Apache +RUN a2enmod actions alias rewrite ssl proxy proxy_fcgi setenvif headers && \ + a2dismod mpm_event && a2enmod mpm_worker +ADD configs/apache/security.conf ${APACHE_CONF_DIR}/conf-available/security-unicaen.conf +RUN a2disconf security.conf && \ + a2enconf security-unicaen.conf php${PHP_VERSION}-fpm + +# Composer 2.x (plus besoin de hirak/prestissimo depuis la 2.x) +RUN curl -sS https://getcomposer.org/installer --proxy "${http_proxy}" | php -- --install-dir=/usr/local/bin --filename=composer + +# Nettoyage +RUN apt-get autoremove -y && apt-get clean && rm -rf /tmp/* /var/tmp/* + +# Copie les fichiers situés dans ./entrypoint.d dans le dossier /entrypoint.d de l'image. +# Les scripts exécutables parmi eux seront exécutés au démarrage du container (cf. entrypoint.sh). +# Attention : les noms de fichiers ne doivent être constitués que de lettres minuscules ou majuscules, +# de chiffres, de tirets bas (underscore) ou de tirets ; extension interdite, donc. +ADD entrypoint.d/* /entrypoint.d/ + +# Entry point +ADD entrypoint.sh /sbin/entrypoint.sh +RUN chmod 755 /sbin/entrypoint.sh +CMD ["/sbin/entrypoint.sh"] diff --git a/Dockerfile7.3+.sh b/Dockerfile-8.x.sh similarity index 95% rename from Dockerfile7.3+.sh rename to Dockerfile-8.x.sh index badfdfaf4a13de2ee0c1ee03a4ea232ee690542d..ea8c5c73002f6f03c344c8e8c7d8ba6e7ee85dca 100755 --- a/Dockerfile7.3+.sh +++ b/Dockerfile-8.x.sh @@ -21,6 +21,7 @@ EOF ################################################################################################################ export PHP_VERSION="$1" +export OCI8_PACKAGE="oci8-3.0.0" export APACHE_CONF_DIR=/etc/apache2 export PHP_CONF_DIR=/etc/php/${PHP_VERSION} @@ -114,7 +115,7 @@ unzip -o /tmp/instantclient-sdk-linux.x64-18.5.0.0.0dbru.zip -d /usr/local/ && \ unzip -o /tmp/instantclient-sqlplus-linux.x64-18.5.0.0.0dbru.zip -d /usr/local/ && \ ln -sf /usr/local/instantclient_18_5 /usr/local/instantclient && \ ln -sf /usr/local/instantclient/sqlplus /usr/local/bin/sqlplus && \ -echo 'instantclient,/usr/local/instantclient' | pecl install oci8 && \ +echo 'instantclient,/usr/local/instantclient' | pecl install ${OCI8_PACKAGE} && \ echo "extension=oci8.so" > ${PHP_CONF_DIR}/fpm/conf.d/30-php-oci8.ini && \ echo "extension=oci8.so" > ${PHP_CONF_DIR}/cli/conf.d/30-php-oci8.ini && \ echo "/usr/local/instantclient" > /etc/ld.so.conf.d/oracle-instantclient.conf && ldconfig @@ -125,9 +126,8 @@ cp configs/apache/security.conf ${APACHE_CONF_DIR}/conf-available/security-unica a2disconf security.conf && \ a2enconf security-unicaen.conf php${PHP_VERSION}-fpm -# Composer -curl -sS https://getcomposer.org/installer --proxy "${http_proxy}" | php -- --install-dir=/usr/local/bin --filename=composer && \ -composer global require hirak/prestissimo --no-plugins --no-scripts +# Composer 2.x (plus besoin de hirak/prestissimo depuis la 2.x) +curl -sS https://getcomposer.org/installer --proxy "${http_proxy}" | php -- --install-dir=/usr/local/bin --filename=composer # Nettoyage apt autoremove -y && apt clean diff --git a/README.md b/README.md index 04ca05054f501953f95e0a3ed5772bf41262c0e1..c1485d5d968fdcb98b40352e5239db2bfff72b03 100644 --- a/README.md +++ b/README.md @@ -22,105 +22,50 @@ docker build \ --rm \ --build-arg PHP_VERSION=${PHP_VERSION} \ --build-arg OCI8_PACKAGE="oci8-2.0.12" \ --f Dockerfile \ +-f Dockerfile-5.x \ -t unicaen-dev-php${PHP_VERSION}-apache \ . ``` -Si vous êtes derrière un proxy, reportez-vous au paragraphe [Proxy](#Proxy). +*Si vous êtes derrière un proxy, reportez-vous au paragraphe [Proxy](#Proxy).* -### PHP 7.0 - -```bash -PHP_VERSION=7.0 ; \ -docker build \ ---rm \ ---build-arg PHP_VERSION=${PHP_VERSION} \ ---build-arg OCI8_PACKAGE="oci8" \ --f Dockerfile \ --t unicaen-dev-php${PHP_VERSION}-apache \ -. -``` - -Si vous êtes derrière un proxy, reportez-vous au paragraphe [Proxy](#Proxy). - -### PHP 7.1 - -```bash -PHP_VERSION=7.1 ; \ -docker build \ ---rm \ ---build-arg PHP_VERSION=${PHP_VERSION} \ ---build-arg OCI8_PACKAGE="oci8" \ --f Dockerfile \ --t unicaen-dev-php${PHP_VERSION}-apache \ -. -``` - -Si vous êtes derrière un proxy, reportez-vous au paragraphe [Proxy](#Proxy). - -### PHP 7.2 - -```bash -PHP_VERSION=7.2 ; \ -docker build \ ---rm \ ---build-arg PHP_VERSION=${PHP_VERSION} \ ---build-arg OCI8_PACKAGE="oci8" \ --f Dockerfile \ --t unicaen-dev-php${PHP_VERSION}-apache \ -. -``` - -Si vous êtes derrière un proxy, reportez-vous au paragraphe [Proxy](#Proxy). - -### PHP 7.3 +### PHP 7.x +Exemple pour PHP 7.3 : ```bash PHP_VERSION=7.3 ; \ docker build \ --rm \ --build-arg PHP_VERSION=${PHP_VERSION} \ ---build-arg OCI8_PACKAGE="oci8" \ --f Dockerfile \ +-f Dockerfile-7.x \ -t unicaen-dev-php${PHP_VERSION}-apache \ . ``` -Si vous êtes derrière un proxy, reportez-vous au paragraphe [Proxy](#Proxy). +*Si vous êtes derrière un proxy, reportez-vous au paragraphe [Proxy](#Proxy).* -### PHP 7.4 +### PHP 8.x +Exemple pour PHP 8.0 : ```bash -PHP_VERSION=7.4 ; \ +PHP_VERSION=8.0 ; \ docker build \ --rm \ --build-arg PHP_VERSION=${PHP_VERSION} \ ---build-arg OCI8_PACKAGE="oci8" \ --f Dockerfile \ +-f Dockerfile-8.x \ -t unicaen-dev-php${PHP_VERSION}-apache \ . ``` -Si vous êtes derrière un proxy, reportez-vous au paragraphe [Proxy](#Proxy). - ### Proxy -Si vous êtes derrière un proxy, passez les variables `*_proxy` à la commande `build` avec `--build-arg`. +Si vous êtes derrière un proxy, passez les variables `*_proxy` à la commande `build` avec des `--build-arg` additionnels. Exemple : ```bash -PHP_VERSION=7.3 ; \ -docker build \ ---rm \ ---build-arg PHP_VERSION=${PHP_VERSION} \ ---build-arg OCI8_PACKAGE="oci8" \ --build-arg http_proxy=http://proxy.unicaen.fr:3128 \ --build-arg https_proxy=http://proxy.unicaen.fr:3128 \ --build-arg no_proxy=*.unicaen.fr \ --f Dockerfile \ --t unicaen-dev-php${PHP_VERSION}-apache \ -. ```