Commit 916e5fcf authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

sudo & toilette

parent b0b36aa0
Loading
Loading
Loading
Loading
Loading
+5 −12
Original line number Diff line number Diff line
@@ -17,8 +17,8 @@ FROM composer:2.3.10 AS get-composer

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

FROM debian:buster AS distrib
#FROM localhost:5000/stretch
FROM debian:bullseye AS distrib
#FROM localhost:5000/bullseye AS distrib

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

@@ -26,7 +26,6 @@ ARG PHP_VERSION

# Variables d'ENVironnement nécessaires au build
ENV PHP_VERSION=${PHP_VERSION} \
    OCI8_PACKAGE="oci8-2.2.0" \
    APACHE_CONF_DIR=/etc/apache2 \
    PHP_CONF_DIR=/etc/php/${PHP_VERSION}

@@ -83,7 +82,6 @@ RUN apt-get -qq update && \
    apt-get -y install apt-transport-https lsb-release ca-certificates curl && \
    curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg && \
    sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'

#    wget --no-check-certificate -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

@@ -120,17 +118,12 @@ RUN apt-get -qq update && \
RUN update-alternatives --set php /usr/bin/php${PHP_VERSION}

# Config PHP
ADD ${PHP_CONF_LOCAL_DIR}/opcache.ini ${PHP_CONF_DIR}/fpm/conf.d/90-opcache.ini
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
ADD ${PHP_CONF_LOCAL_DIR}/90-unicaen.ini     ${PHP_CONF_DIR}/fpm/conf.d/90-unicaen.ini
ADD ${PHP_CONF_LOCAL_DIR}/91-unicaen-dev.ini ${PHP_CONF_DIR}/fpm/conf.d/91-unicaen-dev.ini

# Composer
COPY --from=get-composer /usr/bin/composer /usr/local/bin/composer

## Install de laminas-migration
#RUN composer global require laminas/laminas-migration && \
#    ln -s /root/.composer/vendor/bin/laminas-migration /usr/local/bin/laminas-migration

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

FROM php AS apache
@@ -147,7 +140,7 @@ RUN a2disconf security.conf && \


# Nettoyage
RUN apt-get autoremove -y && apt-get clean && rm -rf /tmp/* /var/tmp/*
RUN apt-get autoremove -y && apt-get 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).
+20 −41
Original line number Diff line number Diff line
@@ -20,12 +20,11 @@ EOF

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

#export http_proxy=
#export https_proxy=
#export no_proxy=
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
export PHP_CONF_DIR=/etc/php/${PHP_VERSION}

@@ -35,19 +34,18 @@ 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 \"${https_proxy}\";" >> /etc/apt/apt.conf.d/05proxy
apt -qq update && apt -y full-upgrade
sudo -E apt -qq update && apt -y full-upgrade

# PHP 7.x PPA repository
apt install -y wget lsb-release apt-transport-https ca-certificates
sudo -E apt install -y wget lsb-release apt-transport-https ca-certificates
#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
sudo -E 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" | sudo tee /etc/apt/sources.list.d/php.list

# Installation des packages requis.
apt -qq update && \
    apt install -y \
sudo -E apt install -y \
    apache2 \
    ca-certificates \
    curl \
@@ -104,44 +102,25 @@ apt -qq update && \
    zlib1g-dev

# Forçage de la version de PHP CLI
update-alternatives --set php /usr/bin/php${PHP_VERSION}
sudo update-alternatives --set php /usr/bin/php${PHP_VERSION}

# Config PHP.
cp ${PHP_CONF_LOCAL_DIR}/opcache.ini ${PHP_CONF_DIR}/fpm/conf.d/90-opcache.ini
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/
#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
sudo cp ${PHP_CONF_LOCAL_DIR}/90-unicaen.ini     ${PHP_CONF_DIR}/fpm/conf.d/90-unicaen.ini
sudo cp ${PHP_CONF_LOCAL_DIR}/91-unicaen-dev.ini ${PHP_CONF_DIR}/fpm/conf.d/91-unicaen-dev.ini

# 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
sudo a2enmod actions alias rewrite ssl proxy proxy_fcgi setenvif headers && \
sudo a2dismod mpm_event mpm_prefork && \
sudo a2enmod mpm_worker
sudo cp ${APACHE_CONF_LOCAL_DIR}/security.conf ${APACHE_CONF_DIR}/conf-available/security-unicaen.conf
sudo a2disconf security.conf && \
sudo 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

# Install de laminas-migration
composer global require laminas/laminas-migration && \
ln -s /root/.composer/vendor/bin/laminas-migration /usr/local/bin/laminas-migration
sudo -E curl -sS https://getcomposer.org/installer | sudo -E php -- --install-dir=/usr/local/bin --filename=composer

# Nettoyage
apt autoremove -y && apt clean
sudo apt autoremove -y && sudo 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).
@@ -152,6 +131,6 @@ cp entrypoint.d/* /entrypoint.d/

# Entry point
cp entrypoint.sh /sbin/entrypoint.sh
chmod 755 /sbin/entrypoint.sh
sudo chmod 755 /sbin/entrypoint.sh
export WITHOUT_DOCKER=1
bash /sbin/entrypoint.sh
+9 −10
Original line number Diff line number Diff line
@@ -17,8 +17,8 @@ FROM composer:2.3.10 AS get-composer

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

FROM debian:buster AS distrib
#FROM localhost:5000/stretch
FROM debian:bullseye AS distrib
#FROM localhost:5000/bullseye AS distrib

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

@@ -79,13 +79,11 @@ FROM distrib AS php

# Repositories fournissant PHP 5.x, 7.x et 8.x
RUN apt-get -qq update && \
    apt-get install -y \
        wget \
        lsb-release \
        apt-transport-https \
        ca-certificates && \
    wget --no-check-certificate -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
    apt-get -y install apt-transport-https lsb-release ca-certificates curl && \
    curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg && \
    sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
#    wget --no-check-certificate -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

RUN apt-get -qq update && \
    apt-get install -y \
@@ -120,6 +118,7 @@ RUN update-alternatives --set php /usr/bin/php${PHP_VERSION}

# Config PHP
ADD ${PHP_CONF_LOCAL_DIR}/90-unicaen.ini     ${PHP_CONF_DIR}/fpm/conf.d/90-unicaen.ini
ADD ${PHP_CONF_LOCAL_DIR}/91-unicaen-dev.ini ${PHP_CONF_DIR}/fpm/conf.d/91-unicaen-dev.ini

# Composer
COPY --from=get-composer /usr/bin/composer /usr/local/bin/composer
@@ -140,7 +139,7 @@ RUN a2disconf security.conf && \


# Nettoyage
RUN apt-get autoremove -y && apt-get clean && rm -rf /tmp/* /var/tmp/*
RUN apt-get autoremove -y && apt-get 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).
+20 −19
Original line number Diff line number Diff line
@@ -20,9 +20,9 @@ EOF

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

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

export PHP_VERSION="$1"
export APACHE_CONF_DIR=/etc/apache2
@@ -34,19 +34,18 @@ export PHP_CONF_LOCAL_DIR=configs/php/8.x
# Mise à niveau de la distrib
#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
sudo -E apt -qq update && apt -y full-upgrade

# PHP 7.x PPA repository
apt install -y wget lsb-release apt-transport-https ca-certificates
sudo -E apt install -y wget lsb-release apt-transport-https ca-certificates
#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
sudo -E 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" | sudo tee /etc/apt/sources.list.d/php.list

# Installation des packages requis.
apt -qq update && \
    apt install -y \
sudo -E apt install -y \
    apache2 \
    ca-certificates \
    curl \
@@ -102,23 +101,25 @@ apt -qq update && \
    zlib1g-dev

# Forçage de la version de PHP CLI
update-alternatives --set php /usr/bin/php${PHP_VERSION}
sudo update-alternatives --set php /usr/bin/php${PHP_VERSION}

# Config PHP.
cp ${PHP_CONF_LOCAL_DIR}/90-unicaen.ini ${PHP_CONF_DIR}/fpm/conf.d/90-unicaen.ini
sudo cp ${PHP_CONF_LOCAL_DIR}/90-unicaen.ini     ${PHP_CONF_DIR}/fpm/conf.d/90-unicaen.ini
sudo cp ${PHP_CONF_LOCAL_DIR}/91-unicaen-dev.ini ${PHP_CONF_DIR}/fpm/conf.d/91-unicaen-dev.ini

# 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
sudo a2enmod actions alias rewrite ssl proxy proxy_fcgi setenvif headers && \
sudo a2dismod mpm_event mpm_prefork && \
sudo a2enmod mpm_worker
sudo cp ${APACHE_CONF_LOCAL_DIR}/security.conf ${APACHE_CONF_DIR}/conf-available/security-unicaen.conf
sudo a2disconf security.conf && \
sudo a2enconf security-unicaen.conf php${PHP_VERSION}-fpm

# Composer
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
sudo -E curl -sS https://getcomposer.org/installer | sudo -E php -- --install-dir=/usr/local/bin --filename=composer

# Nettoyage
apt autoremove -y && apt clean && rm -rf /tmp/* /var/tmp/*
sudo apt autoremove -y && sudo 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).
@@ -129,6 +130,6 @@ cp entrypoint.d/* /entrypoint.d/

# Entry point
cp entrypoint.sh /sbin/entrypoint.sh
chmod 755 /sbin/entrypoint.sh
sudo chmod 755 /sbin/entrypoint.sh
export WITHOUT_DOCKER=1
bash /sbin/entrypoint.sh
+31 −0
Original line number Diff line number Diff line
date.timezone = Europe/Paris
log_errors = On
display_startup_errors = On
display_errors = On
error_reporting = E_ALL
upload_max_filesize = 51M
post_max_size = 60M



opcache.enable=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli=1



# Xdebug v3
xdebug.mode = off
xdebug.client_host = localhost
xdebug.client_port = 9003
xdebug.start_with_request = yes
xdebug.remote_handler = dbgp
xdebug.discover_client_host = true
xdebug.cli_color = 1
xdebug.var_display_max_data = 512       # controls how large strings can be before they're truncated
xdebug.var_display_max_depth = 3        # controls how many levels deep into a data structure information is shown.
xdebug.var_display_max_children = 1024  # controls how many array elements or object properties are shown.
Loading