Public Repository

Last pushed: 7 months ago
Short Description
https://github.com/dhduc/magento2devbox-web
Full Description

FROM php:7.0.12-fpm
MAINTAINER "Magento"

ENV PHP_EXTRA_CONFIGURE_ARGS="--enable-fpm --with-fpm-user=magento2 --with-fpm-group=magento2"

RUN apt-get update && apt-get install -y \
apt-utils \
sudo \
wget \
unzip \
cron \
curl \
libmcrypt-dev \
libicu-dev \
libxml2-dev libxslt1-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng12-dev \
git \
vim \
openssh-server \
supervisor \
mysql-client \
ocaml \
expect \
&& curl -L https://github.com/bcpierce00/unison/archive/2.48.4.tar.gz | tar zxv -C /tmp && \
cd /tmp/unison-2.48.4 && \
sed -i -e 's/GLIBC_SUPPORT_INOTIFY 0/GLIBC_SUPPORT_INOTIFY 1/' src/fsmonitor/linux/inotify_stubs.c && \
make && \
cp src/unison src/unison-fsmonitor /usr/local/bin && \
cd /root && rm -rf /tmp/unison-2.48.4 \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-configure hash --with-mhash \
&& docker-php-ext-install -j$(nproc) mcrypt intl xsl gd zip pdo_mysql opcache soap bcmath json iconv \
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& pecl install xdebug && docker-php-ext-enable xdebug \
&& echo "xdebug.remote_enable=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.remote_port=9000" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.remote_connect_back=0" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.remote_host=127.0.0.1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.idekey=PHPSTORM" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.max_nesting_level=1000" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& chmod 666 /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& mkdir /var/run/sshd \
&& apt-get clean && apt-get update && apt-get install -y nodejs \
&& ln -s /usr/bin/nodejs /usr/bin/node \
&& apt-get install -y npm \
&& npm update -g npm && npm install -g grunt-cli && npm install -g gulp \
&& echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config \
&& apt-get install -y apache2 \
&& a2enmod rewrite \
&& a2enmod proxy \
&& a2enmod proxy_fcgi \
&& rm -f /etc/apache2/sites-enabled/000-default.conf \
&& useradd -m -d /home/magento2 -s /bin/bash magento2 && adduser magento2 sudo \
&& touch /etc/sudoers.d/privacy \
&& echo "Defaults lecture = never" >> /etc/sudoers.d/privacy \
&& mkdir /home/magento2/magento2 && mkdir /var/www/magento2 \
&& mkdir /home/magento2/state \
&& curl -sS https://accounts.magento.cloud/cli/installer -o /home/magento2/installer \
&& rm -r /usr/local/etc/php-fpm.d/* \
&& sed -i 's/www-data/magento2/g' /etc/apache2/envvars

PHP config

ADD conf/php.ini /usr/local/etc/php

SSH config

COPY conf/sshd_config /etc/ssh/sshd_config
RUN chown magento2:magento2 /etc/ssh/ssh_config

supervisord config

ADD conf/supervisord.conf /etc/supervisord.conf

php-fpm config

ADD conf/php-fpm-magento2.conf /usr/local/etc/php-fpm.d/php-fpm-magento2.conf

apache config

ADD conf/apache-default.conf /etc/apache2/sites-enabled/apache-default.conf

unison script

ADD conf/.unison/magento2.prf /home/magento2/.unison/magento2.prf

ADD conf/unison.sh /usr/local/bin/unison.sh
ADD conf/entrypoint.sh /usr/local/bin/entrypoint.sh
ADD conf/check-unison.sh /usr/local/bin/check-unison.sh
RUN chmod +x /usr/local/bin/unison.sh && chmod +x /usr/local/bin/entrypoint.sh \
&& chmod +x /usr/local/bin/check-unison.sh

ENV PATH $PATH:/home/magento2/scripts/:/home/magento2/.magento-cloud/bin
ENV PATH $PATH:/var/www/magento2/bin

ENV USE_SHARED_WEBROOT 1
ENV SHARED_CODE_PATH /var/www/magento2
ENV WEBROOT_PATH /var/www/magento2
ENV MAGENTO_ENABLE_SYNC_MARKER 0

RUN mkdir /windows \
&& cd /windows \
&& curl -L -o unison-windows.zip https://www.irif.fr/~vouillon/unison/unison%202.48.3.zip \
&& unzip unison-windows.zip \
&& rm unison-windows.zip \
&& mv 'unison 2.48.3 text.exe' unison.exe \
&& rm 'unison 2.48.3 GTK.exe' \
&& chown -R magento2:magento2 .

RUN mkdir /mac-osx \
&& cd /mac-osx \
&& curl -L -o unison-mac-osx.zip http://unison-binaries.inria.fr/files/Unison-OS-X-2.48.15.zip \
&& unzip unison-mac-osx.zip \
&& rm unison-mac-osx.zip \
&& chown -R magento2:magento2 .

Initial scripts

COPY scripts/ /home/magento2/scripts/
RUN sed -i 's/^/;/' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& cd /home/magento2/scripts && composer install && chmod +x /home/magento2/scripts/m2init \
&& sed -i 's/^;;*//' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini

RUN chown -R magento2:magento2 /home/magento2 && \
chown -R magento2:magento2 /var/www/magento2 && \
chmod 755 /home/magento2/scripts/bin/magento-cloud-login

Delete user password to connect with ssh with empty password

RUN passwd magento2 -d

EXPOSE 80 22 5000 44100
WORKDIR /home/magento2

USER root

ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

Docker Pull Command
Owner
huuduc2107