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

Dockerfile : ajout de commandes ENV pour les variables d'env *_proxy qui DOIT...

Dockerfile : ajout de commandes ENV pour les variables d'env *_proxy qui DOIT suffire pour propager les variables.
parent f8ee01ae
Loading
Loading
Loading
Loading
Loading
+21 −10
Original line number Diff line number Diff line
@@ -2,37 +2,49 @@
#
#                               Image Unicaen
#
#                                PHP 5.6
#
###########################################################################################

#
# NB: Derrière un proxy, transmission nécessaire des 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>"

# Variables d'ENVironnement nécessaires au build
ARG PHP_VERSION

ENV PHP_VERSION=${PHP_VERSION} \
    OCI8_PACKAGE="oci8-2.0.12" \
    APACHE_CONF_DIR=/etc/apache2 \
    PHP_CONF_DIR=/etc/php/${PHP_VERSION}

ENV HTTP_PROXY=${http_proxy} \
    HTTPS_PROXY=${https_proxy} \
    NO_PROXY=${no_proxy} \
    http_proxy=${http_proxy} \
    https_proxy=${https_proxy} \
    no_proxy=${no_proxy}

ENV APACHE_CONF_LOCAL_DIR=configs/apache \
    PHP_CONF_LOCAL_DIR=configs/php/5.x

# 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
RUN apt-get -qq update

# Repositories fournissant PHP 5.x et 7.x
# Repositories fournissant PHP 5.x, 7.x et 8.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
FROM distrib as install

# Installation des packages communs
RUN apt-get -qq update && \
@@ -101,7 +113,6 @@ ADD ${PHP_CONF_LOCAL_DIR}/php.conf ${PHP_CONF_DIR}/fpm/conf.d/91-unicaen.ini
ADD ${PHP_CONF_LOCAL_DIR}/xdebug.conf ${PHP_CONF_DIR}/fpm/conf.d/92-xdebug.ini

# Package PHP Oracle OCI8
RUN pear config-set http_proxy "${http_proxy}"
ADD resources/instantclient-basiclite-linux.x64-12.2.0.1.0.zip /tmp/
ADD resources/instantclient-sdk-linux.x64-12.2.0.1.0.zip /tmp/
ADD resources/instantclient-sqlplus-linux.x64-12.2.0.1.0.zip /tmp/
@@ -124,7 +135,7 @@ 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 --version 1.10.19 && \
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --version 1.10.19 && \
    composer global require hirak/prestissimo --no-plugins --no-scripts

# Nettoyage
+15 −9
Original line number Diff line number Diff line
@@ -4,6 +4,8 @@
#
#                   Script d'install d'un serveur, traduction du Dockerfile.
#
#                                         PHP 5.6
#
################################################################################################################

usage() {
@@ -18,6 +20,10 @@ EOF

################################################################################################################

#export http_proxy=
#export https_proxy=
#export no_proxy=

export PHP_VERSION="$1"
export OCI8_PACKAGE="oci8-2.0.12"
export APACHE_CONF_DIR=/etc/apache2
@@ -27,20 +33,17 @@ export APACHE_CONF_LOCAL_DIR=configs/apache
export PHP_CONF_LOCAL_DIR=configs/php/5.x

# 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
#echo "Acquire::http::proxy \"${http_proxy}\";" >> /etc/apt/apt.conf.d/05proxy
#echo "Acquire::https::proxy \"${https_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
#echo "http_proxy = ${http_proxy}"  >> /etc/wgetrc
#echo "https_proxy = ${https_proxy}" >> /etc/wgetrc
#echo "no_proxy = ${no_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 && \
@@ -109,6 +112,7 @@ cp ${PHP_CONF_LOCAL_DIR}/php.conf ${PHP_CONF_DIR}/fpm/conf.d/91-unicaen.ini
cp ${PHP_CONF_LOCAL_DIR}/xdebug.conf ${PHP_CONF_DIR}/fpm/conf.d/92-xdebug.ini

# Package PHP Oracle OCI8
#pear config-set http_proxy "${http_proxy}"
cp resources/instantclient-basiclite-linux.x64-12.2.0.1.0.zip /tmp/
cp resources/instantclient-sdk-linux.x64-12.2.0.1.0.zip /tmp/
cp resources/instantclient-sqlplus-linux.x64-12.2.0.1.0.zip /tmp/
@@ -123,14 +127,16 @@ 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
a2enmod actions alias rewrite ssl proxy proxy_fcgi setenvif headers && \
a2dismod mpm_event mpm_prefork && a2enmod mpm_worker
cp ${APACHE_CONF_LOCAL_DIR}/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)
# Composer
curl -sS https://getcomposer.org/installer --proxy "${http_proxy}" | php -- --install-dir=/usr/local/bin --filename=composer --version 1.10.19
composer global require hirak/prestissimo --no-plugins --no-scripts

# Nettoyage
apt autoremove -y && apt clean
+14 −12
Original line number Diff line number Diff line
@@ -2,12 +2,12 @@
#
#                               Image Unicaen
#
#                                PHP >= 7.3
#                                PHP 7.x
#
###########################################################################################

#
# NB: Transmission possible des éventuelles variables d'env `http_*` via `--build-arg` :
# NB: Derrière un proxy, transmission nécessaire des variables d'env `http_*` via `--build-arg` :
#   --build-arg http_proxy
#   --build-arg https_proxy
#   --build-arg no_proxy
@@ -18,30 +18,33 @@ FROM debian:stretch as distrib

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

# Variables d'ENVironnement nécessaires au build
ARG PHP_VERSION

ENV PHP_VERSION=${PHP_VERSION} \
    OCI8_PACKAGE="oci8-2.2.0" \
    APACHE_CONF_DIR=/etc/apache2 \
    PHP_CONF_DIR=/etc/php/${PHP_VERSION}

ENV HTTP_PROXY=${http_proxy} \
    HTTPS_PROXY=${https_proxy} \
    NO_PROXY=${no_proxy} \
    http_proxy=${http_proxy} \
    https_proxy=${https_proxy} \
    no_proxy=${no_proxy}

ENV APACHE_CONF_LOCAL_DIR=configs/apache \
    PHP_CONF_LOCAL_DIR=configs/php/7.x

# 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
RUN apt-get -qq update

# Repositories fournissant PHP 5.x et 7.x
# Repositories fournissant PHP 5.x, 7.x et 8.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
FROM distrib as install

# Installation des packages communs
RUN apt-get -qq update && \
@@ -110,7 +113,6 @@ ADD ${PHP_CONF_LOCAL_DIR}/php.conf ${PHP_CONF_DIR}/fpm/conf.d/91-unicaen.ini
ADD ${PHP_CONF_LOCAL_DIR}/xdebug.conf ${PHP_CONF_DIR}/fpm/conf.d/92-xdebug.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/
@@ -132,7 +134,7 @@ 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 --version 1.10.19 && \
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --version 1.10.19 && \
    composer global require hirak/prestissimo --no-plugins --no-scripts

# Nettoyage
+12 −9
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@
#
#                   Script d'install d'un serveur, traduction du Dockerfile.
#
#                                         PHP >= 7.0
#                                         PHP 7.x
#
################################################################################################################

@@ -20,6 +20,10 @@ EOF

################################################################################################################

#export http_proxy=
#export https_proxy=
#export no_proxy=

export PHP_VERSION="$1"
export OCI8_PACKAGE="oci8-2.2.0"
export APACHE_CONF_DIR=/etc/apache2
@@ -29,20 +33,17 @@ export APACHE_CONF_LOCAL_DIR=configs/apache
export PHP_CONF_LOCAL_DIR=configs/php/7.x

# 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
#echo "Acquire::http::proxy \"${http_proxy}\";" >> /etc/apt/apt.conf.d/05proxy
#echo "Acquire::https::proxy \"${https_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
#echo "http_proxy = ${http_proxy}"  >> /etc/wgetrc
#echo "https_proxy = ${https_proxy}" >> /etc/wgetrc
#echo "no_proxy = ${no_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 && \
@@ -111,6 +112,7 @@ cp ${PHP_CONF_LOCAL_DIR}/php.conf ${PHP_CONF_DIR}/fpm/conf.d/91-unicaen.ini
cp ${PHP_CONF_LOCAL_DIR}/xdebug.conf ${PHP_CONF_DIR}/fpm/conf.d/92-xdebug.ini

# Package PHP Oracle OCI8
#pear config-set http_proxy "${http_proxy}"
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/
@@ -124,6 +126,7 @@ 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
a2enmod actions alias rewrite ssl proxy proxy_fcgi setenvif headers && \
a2dismod mpm_event mpm_prefork && a2enmod mpm_worker
cp ${APACHE_CONF_LOCAL_DIR}/security.conf ${APACHE_CONF_DIR}/conf-available/security-unicaen.conf
+15 −13
Original line number Diff line number Diff line
@@ -2,12 +2,12 @@
#
#                               Image Unicaen
#
#                                PHP >= 8.0
#                                PHP 8.x
#
###########################################################################################

#
# NB: Transmission possible des éventuelles variables d'env `http_*` via `--build-arg` :
# NB: Derrière un proxy, transmission nécessaire des variables d'env `http_*` via `--build-arg` :
#   --build-arg http_proxy
#   --build-arg https_proxy
#   --build-arg no_proxy
@@ -18,30 +18,33 @@ FROM debian:stretch as distrib

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

# Variables d'ENVironnement nécessaires au build
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}

ENV HTTP_PROXY=${http_proxy} \
    HTTPS_PROXY=${https_proxy} \
    NO_PROXY=${no_proxy} \
    http_proxy=${http_proxy} \
    https_proxy=${https_proxy} \
    no_proxy=${no_proxy}

ENV APACHE_CONF_LOCAL_DIR=configs/apache \
    PHP_CONF_LOCAL_DIR=configs/php/8.x

# 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
RUN apt-get -qq update

# Repositories fournissant PHP 5.x et 7.x
# Repositories fournissant PHP 5.x, 7.x et 8.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
FROM distrib as install

# Installation des packages communs
RUN apt-get -qq update && \
@@ -110,7 +113,6 @@ ADD ${PHP_CONF_LOCAL_DIR}/php.conf ${PHP_CONF_DIR}/fpm/conf.d/91-unicaen.ini
ADD ${PHP_CONF_LOCAL_DIR}/xdebug.conf ${PHP_CONF_DIR}/fpm/conf.d/92-xdebug.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/
@@ -132,8 +134,8 @@ 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 --version 1.10.19 && \
    composer global require hirak/prestissimo --no-plugins --no-scripts
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# plus besoin de hirak/prestissimo avec composer v2.

# Nettoyage
RUN apt-get autoremove -y && apt-get clean && rm -rf /tmp/* /var/tmp/*
Loading