123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- FROM debian:stretch
-
- LABEL maintainer="Pascal <pascal.pelissier@logipro.com>"
-
- #
- # Step 1: Installation
- #
-
- # Set frontend. We'll clean this later on!
- ENV DEBIAN_FRONTEND noninteractive
-
- # Locale
- ENV LOCALE fr_FR.UTF-8
-
- # Default Document root.
- ENV DEFAULT_ROOT=/var/www/html
-
- ARG UID=1000
- ARG GID=1000
- ARG UNAME=logiproop
-
- # Set repositories
- RUN \
- echo "deb http://ftp.fr.debian.org/debian/ stretch main non-free contrib" > /etc/apt/sources.list && \
- echo "deb-src http://ftp.fr.debian.org/debian/ stretch main non-free contrib" >> /etc/apt/sources.list && \
- echo "deb http://security.debian.org/ stretch/updates main contrib non-free" >> /etc/apt/sources.list && \
- echo "deb-src http://security.debian.org/ stretch/updates main contrib non-free" >> /etc/apt/sources.list && \
- apt-get -qq update && apt-get -qqy upgrade
-
- # Install some basic tools needed for deployment
- RUN apt-get -yqq install \
- apt-utils \
- build-essential \
- debconf-utils \
- debconf \
- mysql-client \
- locales \
- curl \
- wget \
- unzip \
- patch \
- rsync \
- vim \
- nano \
- openssh-client \
- git \
- bash-completion \
- locales \
- libjpeg-turbo-progs libjpeg-progs \
- pngcrush optipng
-
- # Install locale
- RUN \
- sed -i -e "s/# $LOCALE/$LOCALE/" /etc/locale.gen && \
- echo "LANG=$LOCALE">/etc/default/locale && \
- dpkg-reconfigure --frontend=noninteractive locales && \
- update-locale LANG=$LOCALE
-
- # Configure Sury sources
- # @see https://www.noobunbox.net/serveur/auto-hebergement/installer-php-7-1-sous-debian-et-ubuntu
- RUN \
- apt-get -yqq install apt-transport-https lsb-release ca-certificates && \
- wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg && \
- echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list && \
- apt-get -qq update && apt-get -qqy upgrade
-
- # Install PHP7 with Xdebug (dev environment)
- RUN apt-get -yqq install \
- php7.2 \
- php7.2-curl \
- php7.2-bcmath \
- php7.2-bz2 \
- php7.2-dev \
- php7.2-gd \
- php7.2-dom \
- php7.2-imap \
- php7.2-imagick \
- php7.2-intl \
- php7.2-json \
- php7.2-ldap \
- php7.2-mbstring \
- php7.2-mysql \
- php7.2-oauth \
- php7.2-odbc \
- php7.2-uploadprogress \
- php7.2-ssh2 \
- php7.2-xml \
- php7.2-zip \
- php7.2-solr \
- php7.2-apcu \
- php7.2-opcache \
- php7.2-memcache \
- php7.2-memcached \
- php7.2-redis \
- php7.2-xdebug \
- php7.2-pspell \
- php7.2-xsl \
- libapache2-mod-php7.2
-
-
- # Install manually APC
- RUN \
- echo "extension=apcu.so" > /etc/php/7.2/mods-available/apcu_bc.ini && \
- echo "extension=apc.so" >> /etc/php/7.2/mods-available/apcu_bc.ini
-
- # Install SMTP.
- RUN apt-get install -y ssmtp
-
- # Install Apache web server.
- RUN apt-get -yqq install apache2
-
- #
- # Step 2: Configuration
- #
-
- # Enable uploadprogress, imagick, redis and solr.
- RUN phpenmod uploadprogress imagick redis solr
-
- # Disable by default apcu, apcu_bc, opcache, xdebug and xhprof. Use docker-compose.yml to add file.
- RUN phpdismod apcu apcu_bc opcache xdebug xhprof
-
- # Remove all sites enabled
- # RUN rm /etc/apache2/sites-enabled/*
-
- # Configure needed apache modules and disable default site
- RUN a2dismod mpm_event cgi # mpm_worker enabled.
- RUN a2enmod \
- access_compat \
- actions \
- alias \
- auth_basic \
- authn_core \
- authn_file \
- authz_core \
- authz_groupfile \
- authz_host \
- authz_user \
- autoindex \
- dir \
- env \
- expires \
- filter \
- headers \
- mime \
- negotiation \
- php7.2 \
- mpm_prefork \
- reqtimeout \
- rewrite \
- setenvif \
- status \
- ssl
-
- # without the following line we get "AH00558: apache2: Could not reliably determine the server's fully qualified domain name"
- # autorise .htaccess files
- RUN \
- sed -i '/<Directory \/var\/www\/>/,/<\/Directory>/ s/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
-
- # Install composer (latest version) | prestissimo to speed up composer
- RUN curl -sS https://getcomposer.org/installer | php && \
- mv composer.phar /usr/local/bin/composer && \
- composer global require "hirak/prestissimo:^0.3"
-
- # Bash setup.
- RUN echo ". /usr/share/bash-completion/bash_completion" >> ~/.bashrc && echo "alias ll='ls -lahs'" >> ~/.bashrc
-
- #
- # Step 3: Clean the system
- #
-
- # Cleanup some things.
- RUN apt-get -q autoclean && \
- rm -rf /var/lib/apt/lists/*
-
- #
- # Step 4: Run
- #
-
- # Create 'logiproop' user like local machime user.
- RUN \
- groupadd -g $UID $GID ; \
- useradd -m -u $UID -g $GID -s /bin/bash $UNAME ; \
- usermod -aG www-data $UNAME; \
- echo ". /usr/share/bash-completion/bash_completion" >> ~/.bashrc && echo "alias ll='ls -lahs'" >> /home/$UNAME/.bashrc
-
- # Working dir
- WORKDIR ${DEFAULT_ROOT}
-
- # Configure templates
-
- COPY scripts/apache2-foreground /usr/bin/
-
- EXPOSE 80 443
-
- CMD ["apache2-foreground"]
|