Commit c905e647 authored by Seb's avatar Seb

Utilisation de php-fpm sans apache

parent 3a036267
FROM php:7.2-fpm
LABEL maintainer="sebastien.navaron@periscope.digital"
LABEL php_version="7.2"
LABEL magento_version="2.3.0"
ENV MAGENTO_VERSION 2.3.0
ENV INSTALL_DIR /var/www/html
ENV COMPOSER_HOME /var/www/.composer/
RUN curl -sS https://getcomposer.org/installer | php \
&& mv composer.phar /usr/local/bin/composer
COPY ./conf/auth.json $COMPOSER_HOME
# install the PHP extensions we need
RUN set -ex; \
\
savedAptMark="$(apt-mark showmanual)"; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
libjpeg-dev \
libpng-dev \
; \
\
docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \
docker-php-ext-install gd mysqli opcache zip; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark; \
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
| awk '/=>/ { print $3 }' \
| sort -u \
| xargs -r dpkg-query -S \
| cut -d: -f1 \
| sort -u \
| xargs -rt apt-mark manual; \
\
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*
RUN requirements="libmcrypt-dev libjpeg-dev libmcrypt4 libcurl3-dev libfreetype6 libfreetype6-dev libicu-dev libxslt1-dev unzip" \
&& apt-get update \
&& apt-get install -y $requirements \
&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-install pdo_mysql \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install gd \
&& docker-php-ext-install mbstring \
&& docker-php-ext-install zip \
&& docker-php-ext-install intl \
&& docker-php-ext-install xsl \
&& docker-php-ext-install soap \
&& docker-php-ext-install bcmath \
&& requirementsToRemove="libmcrypt-dev libcurl3-dev libfreetype6-dev" \
&& apt-get purge --auto-remove -y $requirementsToRemove
RUN apt-get update \
&& apt-get install -y libmcrypt-dev \
&& yes '' | pecl install mcrypt-1.0.1 \
&& echo 'extension=mcrypt.so' > /usr/local/etc/php/conf.d/mcrypt.ini
RUN chsh -s /bin/bash www-data
RUN cd /tmp && \
curl https://codeload.github.com/magento/magento2/tar.gz/$MAGENTO_VERSION -o $MAGENTO_VERSION.tar.gz && \
tar xf $MAGENTO_VERSION.tar.gz && \
mv magento2-$MAGENTO_VERSION/* magento2-$MAGENTO_VERSION/.htaccess $INSTALL_DIR
RUN chown -R www-data:www-data /var/www
RUN su www-data -c "cd $INSTALL_DIR && composer install"
RUN su www-data -c "cd $INSTALL_DIR && composer config repositories.magento composer https://repo.magento.com/"
RUN cd $INSTALL_DIR \
&& find . -type d -exec chmod 770 {} \; \
&& find . -type f -exec chmod 660 {} \; \
&& chmod u+x bin/magento
COPY ./conf/install-magento /usr/local/bin/install-magento
RUN chmod +x /usr/local/bin/install-magento
#COPY ./install-sampledata /usr/local/bin/install-sampledata
#RUN chmod +x /usr/local/bin/install-sampledata
#RUN a2enmod rewrite
RUN echo "memory_limit=2048M" > /usr/local/etc/php/conf.d/memory-limit.ini
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
WORKDIR $INSTALL_DIR
# Add cron job
#ADD ./conf/crontab /etc/cron.d/magento2-cron
#RUN chmod 0644 /etc/cron.d/magento2-cron \
#&& crontab -u www-data /etc/cron.d/magento2-cron
{
"http-basic": {
"repo.magento.com": {
"username": "5310458a34d580de1700dfe826ff19a1",
"password": "255059b03eb9d30604d5ef52fca7465d"
}
}
}
\ No newline at end of file
* * * * * www-data /usr/local/bin/php /var/www/html/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /var/www/html/var/log/magento.cron.log
* * * * * www-data /usr/local/bin/php /var/www/html/bin/magento indexer:reindex
#!/usr/bin/env bash
su www-data <<EOSU
/var/www/html/bin/magento setup:install --base-url=$MAGENTO_URL --backend-frontname=$MAGENTO_BACKEND_FRONTNAME --language=$MAGENTO_LANGUAGE --timezone=$MAGENTO_TIMEZONE --currency=$MAGENTO_DEFAULT_CURRENCY --db-host=$MYSQL_HOST --db-name=$MYSQL_DATABASE --db-user=$MYSQL_USER --db-password=$MYSQL_PASSWORD --use-secure=$MAGENTO_USE_SECURE --base-url-secure=$MAGENTO_BASE_URL_SECURE --use-secure-admin=$MAGENTO_USE_SECURE_ADMIN --admin-firstname=$MAGENTO_ADMIN_FIRSTNAME --admin-lastname=$MAGENTO_ADMIN_LASTNAME --admin-email=$MAGENTO_ADMIN_EMAIL --admin-user=$MAGENTO_ADMIN_USERNAME --admin-password=$MAGENTO_ADMIN_PASSWORD
EOSU
\ No newline at end of file
[www]
pm = {FPM_MODE}
pm.max_children = {FPM_MAX_CHILDREN}
pm.start_servers = {FPM_START_SERVERS}
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.max_requests = 500
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment