Commit e38487d2 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Changement de configuration docker pour coller à celui de SyGAL

parent 5b9edc2f
Loading
Loading
Loading
Loading
+24 −77
Changes for Dockerfile: 24 added lines, 77 removed lines.
Original line number Diff line number Diff line
@@ -2,90 +2,37 @@
#
#                               Image pour le dev.
#
#         Montage des sources attendu dans le volume "/webapp" du container.
#
###########################################################################################

FROM php:7.0-apache
ARG PHP_VERSION

LABEL maintainer="Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>"
FROM unicaen-dev-php${PHP_VERSION}-apache

# Mise à niveau de la distrib et installation des packages requis.
RUN apt-get update
RUN apt-get install -y \
        ghostscript \
        git \
        libaio1 \
        libcurl4-openssl-dev \
        libfreetype6-dev \
        libicu-dev \
        libjpeg62-turbo-dev \
        libldap2-dev \
        libmcrypt-dev \
        libmemcached-dev \
        libssl-dev \
        libxml2-dev \
        make \
        netcat-openbsd \
        ssl-cert \
        subversion \
        unzip \
        vim \
        wget \
        zlib1g-dev
RUN apt-get install -y \
        libpq-dev
RUN docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu && \
    docker-php-ext-configure opcache --enable-opcache && \
    docker-php-ext-install -j$(nproc) \
        curl \
        gd \
        gettext \
        iconv \
        intl \
        ldap \
        mbstring \
        opcache \
        pdo \
        pdo_mysql \
        soap \
        zip
RUN docker-php-ext-install -j$(nproc) \
        pdo_pgsql
RUN rm -rf /var/lib/apt/lists/*
LABEL maintainer="Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>"

# Installation d'extensions PECL
RUN pear config-set http_proxy "$HTTP_PROXY" && \
    pecl install xdebug && docker-php-ext-enable xdebug && \
    pecl install memcached && docker-php-ext-enable memcached
## Installation de packages requis.
RUN apt-get update -qq && \
    apt-get install -y \
        ghostscript-x \
        php${PHP_VERSION}-imagick

# Package PHP Oracle OCI8
ADD docker/instantclient-basiclite-linux.x64-12.2.0.1.0.zip /tmp/
ADD docker/instantclient-sdk-linux.x64-12.2.0.1.0.zip /tmp/
ADD docker/instantclient-sqlplus-linux.x64-12.2.0.1.0.zip /tmp/
RUN unzip /tmp/instantclient-basiclite-linux.x64-12.2.0.1.0.zip -d /usr/local/ && \
    unzip /tmp/instantclient-sdk-linux.x64-12.2.0.1.0.zip -d /usr/local/ && \
    unzip /tmp/instantclient-sqlplus-linux.x64-12.2.0.1.0.zip -d /usr/local/ && \
    ln -s /usr/local/instantclient_12_2 /usr/local/instantclient && \
    ln -s /usr/local/instantclient/libclntsh.so.12.1 /usr/local/instantclient/libclntsh.so && \
    ln -s /usr/local/instantclient/sqlplus /usr/bin/sqlplus && \
    echo 'export LD_LIBRARY_PATH="/usr/local/instantclient"' >> /etc/apache2/envvars && \
#    echo 'export LD_LIBRARY_PATH="/usr/local/instantclient"' >> /root/.bashrc && \
#    echo 'umask 002' >> /root/.bashrc && \
    echo 'instantclient,/usr/local/instantclient' | pecl install oci8 && \
    echo "extension=oci8.so" > /usr/local/etc/php/conf.d/php-oci8.ini
# Nettoyage
RUN apt-get autoremove -y && apt-get clean && rm -rf /tmp/* /var/tmp/*

ENV LD_LIBRARY_PATH /usr/local/instantclient
# 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

# Config PHP.
ADD docker/php.conf /usr/local/etc/php/conf.d/webapp.ini
#ADD docker/php-opcache.ini /usr/local/etc/php/conf.d/01-opcache.ini
# Configuration Apache, PHP et FPM
ADD docker/apache-ports.conf    ${APACHE_CONF_DIR}/ports.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/90-app.ini

# Configuration et activation des sites Apache
ADD docker/apache-ports.conf    /etc/apache2/ports.conf
ADD docker/apache-site.conf     /etc/apache2/sites-available/webapp.conf
RUN a2enmod alias rewrite ssl && \
    a2ensite webapp
# Copie des scripts complémentaires à lancer au démarrage du container
COPY docker/entrypoint.d/* /entrypoint.d/

# Install Composer.
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN a2ensite app app-ssl && \
    service php${PHP_VERSION}-fpm reload
+x+55
Changes for Dockerfile.sh: 55 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.
#

usage() {
  cat << EOF
Script d'install d'un serveur, traduction du Dockerfile.
Usage: $0 <version de PHP>
EOF
  exit 0;
}

[[ -z "$1" ]] && usage

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

PHP_VERSION="$1"
SYGAL_DIR=$(cd `dirname $0` && pwd)

set -e

# Minimum vital
apt-get -qq update && \
apt-get install -y \
    git \
    nano

# Récupération de l'image Docker Unicaen et lancement de son Dockerfile.sh
export UNICAEN_IMAGE_TMP_DIR=/tmp/docker-unicaen-image
git clone https://git.unicaen.fr/open-source/docker/unicaen-image.git ${UNICAEN_IMAGE_TMP_DIR}
cd ${UNICAEN_IMAGE_TMP_DIR}
. Dockerfile.sh ${PHP_VERSION}


cd ${SYGAL_DIR}

# NB: Variables d'env exportées par ${UNICAEN_IMAGE_TMP_DIR}/Dockerfile.sh
# APACHE_CONF_DIR=/etc/apache2
# PHP_CONF_DIR="/etc/php/$1"

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

sed -i -re 's/SetEnv APPLICATION_ENV "(development|test)"/SetEnv APPLICATION_ENV "production"/' \
    ${APACHE_CONF_DIR}/sites-available/app-ssl.conf

a2ensite app app-ssl && \
    service apache2 reload && \
    service php${PHP_VERSION}-fpm reload
+6 −3
Changes for docker-compose.yml: 6 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -4,11 +4,14 @@ services:
  preecog:
    container_name: preecog
    build:
      args:
        PHP_VERSION: 7.0
      context: .
      dockerfile: Dockerfile
    ports:
     - "8111:80"
     - "8112:80"
     - "8111:443"
    volumes:
     - .:/var/www/html/preecog
     - .:/app
     - /tmp:/tmp
    working_dir: /var/www/html/preecog
    working_dir: /app
+1
Changes for docker/apache-ports.conf: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
Listen 80
Listen 443
+30
Changes for docker/apache-site-ssl.conf: 30 added lines, 0 removed lines.
Original line number Diff line number Diff line
<VirtualHost *:443>
     ServerName localhost
     DocumentRoot /app/public

     SetEnv APPLICATION_ENV "development"

     RewriteEngine On

     <Directory /app/public>
         DirectoryIndex index.php
         AllowOverride All
         Require all granted
     </Directory>

    <IfModule proxy_fcgi_module>
        <FilesMatch ".+\.ph(ar|p|tml)$">
            SetHandler "proxy:unix:/var/run/php-fpm.sock|fcgi://localhost/"
        </FilesMatch>
    </IfModule>

     SSLEngine on
     SSLCertificateFile	/etc/ssl/certs/ssl-cert-snakeoil.pem
     SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

     Header always set Strict-Transport-Security "max-age=15768000; includeSubdomains;"

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined
     #LogLevel debug
</VirtualHost>
Loading