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

Docker: Dockerfiles supplémentaires (PHP 7.1 et 7.2) ; possibilité d'inclure...

Docker: Dockerfiles supplémentaires (PHP 7.1 et 7.2) ; possibilité d'inclure dans docker/entrypoint.d des scripts exécutés au démarrage du container (NB: rebuild image unicaen nécessaire)
parent 8f7d256b
Loading
Loading
Loading
Loading
+9 −4
Changes for Dockerfile: 9 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -4,18 +4,20 @@
#
###########################################################################################

FROM unicaen-dev-php7.0-apache
ARG PHP_VERSION=7.0

FROM unicaen-dev-php${PHP_VERSION}-apache

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

ENV APACHE_CONF_DIR=/etc/apache2 \
    PHP_CONF_DIR=/etc/php/7.0
    PHP_CONF_DIR=/etc/php/${PHP_VERSION}

## Installation de packages requis.
RUN apt-get update -qq && \
    apt-get install -y \
        ghostscript-x \
        php7.0-imagick
        php${PHP_VERSION}-imagick

# Nettoyage
RUN apt-get autoremove -y && apt-get clean && rm -rf /tmp/* /var/tmp/*
@@ -32,5 +34,8 @@ ADD docker/apache-site-ssl.conf ${APACHE_CONF_DIR}/sites-available/sygal-ssl.con
ADD docker/fpm/pool.d/app.conf  ${PHP_CONF_DIR}/fpm/pool.d/sygal.conf
ADD docker/fpm/conf.d/app.ini   ${PHP_CONF_DIR}/fpm/conf.d/sygal.ini

# Copie des scripts complémentaires à lancer au démarrage du container
COPY docker/entrypoint.d/* /entrypoint.d/

RUN a2ensite sygal sygal-ssl && \
    service php7.0-fpm reload
    service php${PHP_VERSION}-fpm reload

Dockerfile-7.1

0 → 100644
+40 −0
Changes for Dockerfile-7.1: 40 added lines, 0 removed lines.
Original line number Diff line number Diff line
###########################################################################################
#
#                               Image pour le dev.
#
###########################################################################################

ARG PHP_VERSION=7.1

FROM unicaen-dev-php${PHP_VERSION}-apache

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

ENV APACHE_CONF_DIR=/etc/apache2 \
    PHP_CONF_DIR=/etc/php/${PHP_VERSION}

## Installation de packages requis.
RUN apt-get update && apt-get install -y \
        ghostscript-x \
        php${PHP_VERSION}-imagick

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

# Symlink apache access and error logs to stdout/stderr so Docker logs shows them
RUN ln -sf /dev/stdout /var/log/apache2/access.log
RUN ln -sf /dev/stdout /var/log/apache2/other_vhosts_access.log
RUN ln -sf /dev/stderr /var/log/apache2/error.log

# Configuration Apache et FPM
ADD docker/apache-ports.conf    ${APACHE_CONF_DIR}/ports.conf
ADD docker/apache-site.conf     ${APACHE_CONF_DIR}/sites-available/sygal.conf
ADD docker/apache-site-ssl.conf ${APACHE_CONF_DIR}/sites-available/sygal-ssl.conf
ADD docker/fpm/pool.d/app.conf  ${PHP_CONF_DIR}/fpm/pool.d/sygal.conf
ADD docker/fpm/conf.d/app.ini   ${PHP_CONF_DIR}/fpm/conf.d/sygal.ini

# Copie des scripts complémentaires à lancer au démarrage du container
COPY docker/entrypoint.d/* /entrypoint.d/

RUN a2ensite sygal sygal-ssl && \
    service php${PHP_VERSION}-fpm reload

Dockerfile-7.2

0 → 100644
+40 −0
Changes for Dockerfile-7.2: 40 added lines, 0 removed lines.
Original line number Diff line number Diff line
###########################################################################################
#
#                               Image pour le dev.
#
###########################################################################################

ARG PHP_VERSION=7.1

FROM unicaen-dev-php${PHP_VERSION}-apache

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

ENV APACHE_CONF_DIR=/etc/apache2 \
    PHP_CONF_DIR=/etc/php/${PHP_VERSION}

## Installation de packages requis.
RUN apt-get update && apt-get install -y \
        ghostscript-x \
        php${PHP_VERSION}-imagick

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

# Symlink apache access and error logs to stdout/stderr so Docker logs shows them
RUN ln -sf /dev/stdout /var/log/apache2/access.log
RUN ln -sf /dev/stdout /var/log/apache2/other_vhosts_access.log
RUN ln -sf /dev/stderr /var/log/apache2/error.log

# Configuration Apache et FPM
ADD docker/apache-ports.conf    ${APACHE_CONF_DIR}/ports.conf
ADD docker/apache-site.conf     ${APACHE_CONF_DIR}/sites-available/sygal.conf
ADD docker/apache-site-ssl.conf ${APACHE_CONF_DIR}/sites-available/sygal-ssl.conf
ADD docker/fpm/pool.d/app.conf  ${PHP_CONF_DIR}/fpm/pool.d/sygal.conf
ADD docker/fpm/conf.d/app.ini   ${PHP_CONF_DIR}/fpm/conf.d/sygal.ini

# Copie des scripts complémentaires à lancer au démarrage du container
COPY docker/entrypoint.d/* /entrypoint.d/

RUN a2ensite sygal sygal-ssl && \
    service php${PHP_VERSION}-fpm reload
+3 −0
Changes for docker/entrypoint.d/002_hello: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
#!/usr/bin/env bash

echo ">>>>>>> :-p Hello from $0 !!"
+13 −0
Changes for docker/entrypoint.d/README.md: 13 added lines, 0 removed lines.
Original line number Diff line number Diff line
# Répertoire `entrypoint.d`

Lors du build, tous les fichiers situés dans `./entrypoint.d` sont copiés dans le dossier `/entrypoint.d` de l'image.

Au démarrage du container, seuls les scripts exécutables parmi ces fichiers seront lancés (cf. `./entrypoint.sh`) par 
la commande [`run-pats`](https://manpages.debian.org/stretch/debianutils/run-parts.8.fr.html).

**Attention** :
- Le nom d'un script ne doit être constitué que de lettres minuscules ou majuscules,
  de chiffres, de tirets bas (underscore) ou de tirets. 
  *Extension interdite, donc.*
- Les fichiers sont exécutés dans l'ordre lexicographique de leur nom.
 
 No newline at end of file