Skip to content
Snippets Groups Projects
Commit 0c539ded authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Docker: utilisation d'une variable PHP_VERSION

parent 0ba28e5e
No related branches found
No related tags found
No related merge requests found
Pipeline #4180 passed
......@@ -4,19 +4,22 @@
#
###########################################################################################
FROM unicaen-dev-php7.2-apache
ARG PHP_VERSION
FROM unicaen-dev-php${PHP_VERSION}-apache
LABEL maintainer="Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>"
WORKDIR /app
ENV APACHE_CONF_DIR=/etc/apache2 \
PHP_CONF_DIR=/etc/php/7.2
PHP_CONF_DIR=/etc/php/${PHP_VERSION}
## Installation de packages requis.
RUN apt-get update -qq && apt-get install -y \
RUN apt-get update -qq && \
apt-get install -y \
sqlite3 \
php7.2-pdo-sqlite
php${PHP_VERSION}-pdo-sqlite
RUN pecl install ast && \
echo "extension=ast.so" > ${PHP_CONF_DIR}/cli/conf.d/ast.ini
......@@ -31,10 +34,10 @@ 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/webapp.conf
ADD docker/apache-site-ssl.conf ${APACHE_CONF_DIR}/sites-available/webapp-ssl.conf
ADD docker/fpm/pool.d/app.conf ${PHP_CONF_DIR}/fpm/pool.d/webapp.conf
ADD docker/apache-site.conf ${APACHE_CONF_DIR}/sites-available/app.conf
ADD docker/apache-site-ssl.conf ${APACHE_CONF_DIR}/sites-available/app-ssl.conf
ADD docker/fpm/pool.d/app.conf ${PHP_CONF_DIR}/fpm/pool.d/app.conf
ADD docker/fpm/conf.d/app.ini ${PHP_CONF_DIR}/fpm/conf.d/app.ini
RUN a2ensite webapp webapp-ssl && \
service php7.2-fpm reload
RUN a2ensite app app-ssl && \
service php${PHP_VERSION}-fpm reload
###########################################################################################
#
# Image pour le dev.
#
###########################################################################################
FROM unicaen-dev-php7.0-apache
LABEL maintainer="Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>"
WORKDIR /app
ENV APACHE_CONF_DIR=/etc/apache2 \
PHP_CONF_DIR=/etc/php/7.0
## Installation de packages requis.
RUN apt-get update -qq && apt-get install -y \
sqlite3 \
php7.0-pdo-sqlite
RUN pecl install ast && \
echo "extension=ast.so" > ${PHP_CONF_DIR}/cli/conf.d/ast.ini
# 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/webapp.conf
ADD docker/apache-site-ssl.conf ${APACHE_CONF_DIR}/sites-available/webapp-ssl.conf
ADD docker/fpm/pool.d/app.conf ${PHP_CONF_DIR}/fpm/pool.d/webapp.conf
ADD docker/fpm/conf.d/app.ini ${PHP_CONF_DIR}/fpm/conf.d/app.ini
RUN a2ensite webapp webapp-ssl && \
service php7.0-fpm reload
###########################################################################################
#
# Image pour le dev.
#
###########################################################################################
FROM unicaen-dev-php7.1-apache
LABEL maintainer="Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>"
WORKDIR /app
ENV APACHE_CONF_DIR=/etc/apache2 \
PHP_CONF_DIR=/etc/php/7.1
## Installation de packages requis.
RUN apt-get update -qq && apt-get install -y \
sqlite3 \
php7.1-pdo-sqlite
RUN pecl install ast && \
echo "extension=ast.so" > ${PHP_CONF_DIR}/cli/conf.d/ast.ini
# 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/webapp.conf
ADD docker/apache-site-ssl.conf ${APACHE_CONF_DIR}/sites-available/webapp-ssl.conf
ADD docker/fpm/pool.d/app.conf ${PHP_CONF_DIR}/fpm/pool.d/webapp.conf
ADD docker/fpm/conf.d/app.ini ${PHP_CONF_DIR}/fpm/conf.d/app.ini
RUN a2ensite webapp webapp-ssl && \
service php7.1-fpm reload
###########################################################################################
#
# Image pour le dev.
#
###########################################################################################
FROM unicaen-dev-php7.2-apache
LABEL maintainer="Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>"
WORKDIR /app
ENV APACHE_CONF_DIR=/etc/apache2 \
PHP_CONF_DIR=/etc/php/7.2
## Installation de packages requis.
RUN apt-get update -qq && apt-get install -y \
sqlite3 \
php7.2-pdo-sqlite
RUN pecl install ast && \
echo "extension=ast.so" > ${PHP_CONF_DIR}/cli/conf.d/ast.ini
# 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/webapp.conf
ADD docker/apache-site-ssl.conf ${APACHE_CONF_DIR}/sites-available/webapp-ssl.conf
ADD docker/fpm/pool.d/app.conf ${PHP_CONF_DIR}/fpm/pool.d/webapp.conf
ADD docker/fpm/conf.d/app.ini ${PHP_CONF_DIR}/fpm/conf.d/app.ini
RUN a2ensite webapp webapp-ssl && \
service php7.2-fpm reload
###########################################################################################
#
# Image pour le dev.
#
###########################################################################################
FROM unicaen-dev-php7.3-apache
LABEL maintainer="Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>"
WORKDIR /app
ENV APACHE_CONF_DIR=/etc/apache2 \
PHP_CONF_DIR=/etc/php/7.3
## Installation de packages requis.
RUN apt-get update -qq && apt-get install -y \
sqlite3 \
php7.3-pdo-sqlite
RUN pecl install ast && \
echo "extension=ast.so" > ${PHP_CONF_DIR}/cli/conf.d/ast.ini
# 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/webapp.conf
ADD docker/apache-site-ssl.conf ${APACHE_CONF_DIR}/sites-available/webapp-ssl.conf
ADD docker/fpm/pool.d/app.conf ${PHP_CONF_DIR}/fpm/pool.d/webapp.conf
ADD docker/fpm/conf.d/app.ini ${PHP_CONF_DIR}/fpm/conf.d/app.ini
RUN a2ensite webapp webapp-ssl && \
service php7.3-fpm reload
......@@ -2,10 +2,12 @@ version: '2'
services:
skeleton-application:
image: skeleton-application-image
container_name: skeleton-application-container
build:
dockerfile: Dockerfile
context: .
args:
PHP_VERSION: 7.0
ports:
- "8880:80"
- "8843:443"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment