docker php71+composer+sudo

FROM ubuntu:16.04
# terminal
ENV TERM linux
ENV DEBIAN_FRONTEND noninteractive

# container environments
ENV APP_ENV prod
ENV APP_VHOST standard

# install essentials
RUN apt-get update \
    && apt-get install -y --no-install-recommends software-properties-common ca-certificates locales curl less nano cron logrotate tar vim xz-utils msmtp\
    && locale-gen en_US \
    && locale-gen en_US.UTF-8 \
    && locale-gen de_DE \
    && locale-gen de_DE.UTF-8 \
    && echo 'alias l="ls -alhF"' > /root/.bash_aliases \
    && apt-get -y autoremove \
    && apt-get -y clean \
    && rm -rf /var/cache/apt/archives/* \
    && rm -rf /var/lib/apt/lists/* \
    && rm -rf /var/tmp/* \
    && rm -rf /usr/share/doc/* \
    && rm -rf /usr/share/man/* \
    && rm -rf /usr/share/locale/* \
    && rm -rf /tmp/*

# set system-wide locale settings
ENV LC_ALL en_US.UTF-8

RUN add-apt-repository ppa:ondrej/php

# install essentials
RUN apt-get update \
    && apt-get install -y --no-install-recommends \
        apache2 \
	curl \
	sudo \
        libapache2-modsecurity \
        php7.1 \
        php7.1-cli \
        php7.1-common \
        php7.1-apcu \
        php7.1-curl \
        php7.1-gd \
        php7.1-geoip \
        php7.1-imagick \
        php7.1-intl \
        php7.1-mbstring \
        php7.1-mcrypt \
        php7.1-memcached \
        php7.1-mongodb \
        php7.1-mysql \
        php7.1-sqlite3 \
        php7.1-ssh \
        php7.1-xml \
        php7.1-yaml \
        php7.1-zip \
	php7.1-ldap \
	php7.1-soap \
	php7.1-bcmath \
	libapache2-mod-rpaf \
	sendmail \
	mailutils \
    && apt-get -y autoremove \
    && apt-get -y clean \
    && rm -rf /var/cache/apt/archives/* \
    && rm -rf /var/lib/apt/lists/* \
    && rm -rf /var/tmp/* \
    && rm -rf /usr/share/doc/* \
    && rm -rf /usr/share/man/* \
    && rm -rf /usr/share/locale/* \
    && rm -rf /tmp/* \
    &&  a2enmod rewrite
ENV PHP_VERSION 7.1

ENV COMPOSER_ALLOW_SUPERUSER 1
ENV COMPOSER_HOME /tmp
ENV COMPOSER_VERSION 1.6.5

RUN curl -s -f -L -o /tmp/installer.php https://raw.githubusercontent.com/composer/getcomposer.org/b107d959a5924af895807021fcef4ffec5a76aa9/web/installer \
 && php -r " \
    \$signature = '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061'; \
    \$hash = hash('SHA384', file_get_contents('/tmp/installer.php')); \
    if (!hash_equals(\$signature, \$hash)) { \
        unlink('/tmp/installer.php'); \
        echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \
        exit(1); \
    }" \
 && php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer --version=${COMPOSER_VERSION} \
 && composer --ansi --version --no-interaction \
&& rm -rf /tmp/* /tmp/.htaccess

# manually set up the apache environment variables
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_LOCK_DIR /var/lock/apache2
ENV APACHE_PID_FILE /var/run/apache2.pid

RUN a2enmod headers \
    && a2enmod rewrite \
    && a2enmod ssl \
    && a2enconf security \
    && mkdir /etc/apache2/certs \
    && chmod 0644 /etc/apache2/conf-available/* \
    && chmod 0644 /etc/apache2/sites-available/* \
    && chmod 0644 /etc/php/${PHP_VERSION}/mods-available/* \
    && usermod -u 33 $APACHE_RUN_USER \
    && groupmod -g 33 $APACHE_RUN_GROUP \
    && rm -rf /etc/apache2/sites-enabled/* \
    && rm -rf /etc/apache2/mods-enabled/rpaf.conf \
    && mkdir -p /root/.composer \
    && chmod -R 777 /root
EXPOSE 80 443

CMD /usr/sbin/apache2ctl -D FOREGROUND; /etc/init.d/sendmail start

 

Docker

Related Articles

0 Comment

Leave a Comment

Ваш адрес email не будет опубликован.