Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 42 additions & 45 deletions 8.0.1/Dockerfile → 8.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# Changes needed on the Dockerfile from PHP 7.3 to 7.4 :
# - gd configure options changed (from "--with-jpeg-dir=/usr/include/" to "--with-jpeg")
# - it is now required to install oniguruma lib for mbstring
# Changes needed on the Dockerfile from PHP 8.0.1 to 8.1 :
# - remove Drush as a global executable, use it per project via Drush launcher (https://github.com/drush-ops/drush-launcher)
# - update mcrypt, apcu
# - use proper configuration for xDebug3
# - add a possible configuration to use apcu if necessary
# - remove usage of Drupal Console as not compatible with PHP > 8.x and not maintained anymore

# Pull base image.
FROM php:8-apache
# Pull base image
FROM php:8.1-apache

# Install tools
RUN apt-get clean && apt-get update && apt-get install --fix-missing wget apt-transport-https lsb-release ca-certificates gnupg2 -y
Expand Down Expand Up @@ -43,7 +46,8 @@ RUN apt-get clean && apt-get update && apt-get install --fix-missing -y \
# postgresql-client-9.5
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - && echo "deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main" >> /etc/apt/sources.list && apt-get update && apt-get install -y postgresql-client-11

RUN pecl install mcrypt-1.0.4 && \
# Install Mcrypt extension
RUN pecl install mcrypt-1.0.5 && \
docker-php-ext-enable mcrypt

# Create new web user for apache and grant sudo without password
Expand All @@ -52,10 +56,10 @@ RUN usermod -aG sudo web
RUN echo 'web ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

# Install YAML extension
RUN pecl install yaml-2.2.1 && echo "extension=yaml.so" > /usr/local/etc/php/conf.d/ext-yaml.ini
RUN pecl install yaml-2.2.2 && echo "extension=yaml.so" > /usr/local/etc/php/conf.d/ext-yaml.ini

# Install APCu extension
RUN pecl install apcu
RUN pecl install apcu-5.1.22

# Install sass and gem dependency
RUN apt-get install --fix-missing automake ruby-dev libtool -y
Expand Down Expand Up @@ -83,28 +87,22 @@ RUN npm install -g bower
RUN cd /usr/src && curl -sS http://getcomposer.org/installer | php
RUN cd /usr/src && mv composer.phar /usr/bin/composer

# Installation of drush 8 & 9
RUN git clone https://github.com/drush-ops/drush.git /usr/local/src/drush
RUN cp -r /usr/local/src/drush/ /usr/local/src/drush8/
RUN cp -r /usr/local/src/drush/ /usr/local/src/drush9/
RUN cd /usr/local/src/drush8 && git checkout -f 8.1.0
RUN cd /usr/local/src/drush8 && composer update && composer install
RUN ln -s /usr/local/src/drush8/drush /usr/bin/drush8
RUN cd /usr/local/src/drush9 && git checkout 9.1.0
RUN cd /usr/local/src/drush9 && composer update && composer install
RUN ln -s /usr/local/src/drush9/drush /usr/bin/drush9

# Install xdebug. ver 3.1
RUN cd /tmp/ && wget http://xdebug.org/files/xdebug-3.1.0.tgz && tar -xvzf xdebug-3.1.0.tgz && cd xdebug-3.1.0/ && phpize && ./configure --enable-xdebug --with-php-config=/usr/local/bin/php-config && make && make install
RUN cd /tmp/xdebug-3.1.0 && cp modules/xdebug.so /usr/local/lib/php/extensions/
RUN echo 'zend_extension = /usr/local/lib/php/extensions/xdebug.so' >> /usr/local/etc/php/php.ini
RUN touch /usr/local/etc/php/conf.d/xdebug.ini &&\
echo 'xdebug.remote_enable=1' >> /usr/local/etc/php/conf.d/xdebug.ini &&\
echo 'xdebug.remote_autostart=0' >> /usr/local/etc/php/conf.d/xdebug.ini &&\
echo 'xdebug.remote_connect_back=0' >> /usr/local/etc/php/conf.d/xdebug.ini &&\
echo 'xdebug.remote_port=9000' >> /usr/local/etc/php/conf.d/xdebug.ini &&\
echo 'xdebug.remote_log=/tmp/php7-xdebug.log' >> /usr/local/etc/php/conf.d/xdebug.ini &&\
echo 'xdebug.remote_host=docker_host' >> /usr/local/etc/php/conf.d/xdebug.ini &&\
# Installation of Drush launcher
RUN wget -O drush.phar https://github.com/drush-ops/drush-launcher/releases/latest/download/drush.phar && \
chmod +x drush.phar && \
sudo mv drush.phar /usr/local/bin/drush

# Install Xdebug
RUN pecl install xdebug-3.1.5
RUN touch /usr/local/etc/php/conf.d/xdebug.ini && \
echo '[xdebug]' >> /usr/local/etc/php/conf.d/xdebug.ini && \
echo 'zend_extension=xdebug.so' >> /usr/local/etc/php/conf.d/xdebug.ini && \
echo 'xdebug.start_with_request=yes' >> /usr/local/etc/php/conf.d/xdebug.ini && \
echo 'xdebug.mode=debug' >> /usr/local/etc/php/conf.d/xdebug.ini && \
echo 'xdebug.discover_client_host=false' >> /usr/local/etc/php/conf.d/xdebug.ini && \
echo 'xdebug.client_port=9000' >> /usr/local/etc/php/conf.d/xdebug.ini && \
echo 'xdebug.log=/tmp/php8-xdebug.log' >> /usr/local/etc/php/conf.d/xdebug.ini && \
echo 'xdebug.client_host=docker_host' >> /usr/local/etc/php/conf.d/xdebug.ini && \
echo 'xdebug.idekey=PHPSTORM' >> /usr/local/etc/php/conf.d/xdebug.ini

# Apache2 config
Expand All @@ -122,12 +120,17 @@ ENV APACHE_RUN_DIR /var/run/apache2
ENV APACHE_LOCK_DIR /var/lock/apache2
ENV APACHE_LOG_DIR /var/log/apache2

# Install php extensions + added mysqli install
# Install php extensions + mysqli
RUN docker-php-ext-install opcache pdo_mysql && docker-php-ext-install mysqli
RUN docker-php-ext-configure gd --with-jpeg
RUN docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/
RUN docker-php-ext-configure ldap --with-libdir=lib/$(uname -m)-linux-gnu/
RUN docker-php-ext-install gd mbstring zip soap pdo_mysql mysqli xsl opcache calendar intl exif pgsql pdo_pgsql ftp bcmath ldap

# Enable APCu package if needed
#RUN docker-php-ext-enable apcu && \
# echo "apc.enabled=1" >> /usr/local/etc/php/conf.d/apcu.ini && \
# echo "apc.enable_cli=1" >> /usr/local/etc/php/conf.d/apcu.ini

# Custom Opcache
RUN ( \
echo "opcache.memory_consumption=128"; \
Expand All @@ -138,34 +141,31 @@ RUN ( \
echo "opcache.enable_cli=1"; \
) >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini

# Apache encore de la config
# Configure Apache
RUN rm -rf /var/www/html && \
mkdir -p /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html && \
chown -R web:www-data /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html
RUN a2enmod rewrite expires ssl && service apache2 restart

# Installation of PHP_CodeSniffer with Drupal coding standards.
# Install PHP_CodeSniffer with Drupal coding standards
# See https://www.drupal.org/node/1419988#coder-composer
RUN composer global require drupal/coder
RUN ln -s ~/.composer/vendor/bin/phpcs /usr/local/bin
RUN ln -s ~/.composer/vendor/bin/phpcbf /usr/local/bin
RUN phpcs --config-set installed_paths ~/.composer/vendor/drupal/coder/coder_sniffer

# install msmtp
# Install msmtp
RUN set -x \
&& DEBIAN_FRONTEND=noninteractive \
&& apt-get update && apt-get install -y --no-install-recommends msmtp && rm -r /var/lib/apt/lists/*
ADD core/msmtprc.conf /usr/local/etc/msmtprc
ADD core/php-smtp.ini /usr/local/etc/php/conf.d/php-smtp.ini

# #install ssmtp
# Install ssmtp
# RUN DEBIAN_FRONTEND=noninteractive apt-get install --fix-missing -y ssmtp && rm -r /var/lib/apt/lists/*
# ADD core/ssmtp.conf /etc/ssmtp/ssmtp.conf
# ADD core/php-smtp.ini /usr/local/etc/php/conf.d/php-smtp.ini

# Install Drupal Console for Drupal 8
RUN curl https://drupalconsole.com/installer -L -o drupal.phar && mv drupal.phar /usr/local/bin/drupal && chmod +x /usr/local/bin/drupal

# Install WKHTMLTOPDF
RUN apt-get update
RUN apt-get install openssl build-essential libssl-dev libxrender-dev git-core libx11-dev libxext-dev libfontconfig1-dev libfreetype6-dev fontconfig -y
Expand All @@ -178,15 +178,15 @@ RUN chmod +x /bin/wkhtmltopdf && chmod +x /bin/wkhtmltoimage
# Our apache volume
VOLUME /var/www/html

# create directory for ssh keys
# Create directory for ssh keys
RUN mkdir /var/www/.ssh/
RUN chown -R web:www-data /var/www/

# Set timezone to Europe/Paris
RUN echo "Europe/Paris" > /etc/timezone && dpkg-reconfigure -f noninteractive tzdata

# Expose 80,443 for apache + 9000 pour xdebug
EXPOSE 80 443 9000
# Expose 80,443 for apache + 9000 for xdebug
EXPOSE 80 443 9000 9003

# Add web .bashrc config
COPY config/bashrc /var/www/
Expand All @@ -209,6 +209,3 @@ COPY config/php.ini /usr/local/etc/php/
COPY core/docker-entrypoint.sh /
RUN chmod 777 /docker-entrypoint.sh && chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]

# CMD ["cat", "/etc/apache2/envvars"]
# CMD ["sed", "-n", "39p", "/etc/apache2/apache2.conf"]
File renamed without changes.
File renamed without changes.
Loading