Commit f616aafd authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Autre Dockerfile installant instanclient v18.5 nécessaire semble-t-il sur le...

Autre Dockerfile installant instanclient v18.5 nécessaire semble-t-il sur le serveur de test de la COMUE (PHP7.3) !
parent ac643202
Loading
Loading
Loading
Loading
Loading

Dockerfile7.3+

0 → 100644
+148 −0
Changes for Dockerfile7.3+: 148 added lines, 0 removed lines.
Original line number Diff line number Diff line
###########################################################################################
#
#                               Image Unicaen
#
#                                PHP >= 7.3
#
###########################################################################################

#
# 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
#FROM localhost:5000/stretch

LABEL maintainer="Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>"

ARG PHP_VERSION
ARG OCI8_PACKAGE

ENV PHP_VERSION=${PHP_VERSION} \
    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

# 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 \
        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}"
instantclient-basiclite-linux.x64-18.5.0.0.0dbru.zip
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

# Scripts maison
ADD scripts/update-satis.sh /usr/local/bin/update-satis
RUN chmod 755 /usr/local/bin/update-satis

# 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

# 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"]

Dockerfile7.3+.sh

0 → 100755
+150 −0
Changes for Dockerfile7.3+.sh: 150 added lines, 0 removed lines.
Original line number Diff line number Diff line
#!/usr/bin/env bash

################################################################################################################
#
#                   Script d'install d'un serveur, traduction du Dockerfile.
#
#                                         PHP >= 7.3
#
################################################################################################################

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 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 && \
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

# Scripts maison
cp scripts/update-satis.sh /usr/local/bin/update-satis
chmod 755 /usr/local/bin/update-satis

# 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

# 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