Skip to content

Instantly share code, notes, and snippets.

@daniloaldm
Created June 14, 2020 15:35
Show Gist options
  • Save daniloaldm/fe849745900cf093b4949da6ee25d52f to your computer and use it in GitHub Desktop.
Save daniloaldm/fe849745900cf093b4949da6ee25d52f to your computer and use it in GitHub Desktop.
FROM php:7.2-apache
ENV XDEBUG_PORT 9000
# Install System Dependencies
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
software-properties-common \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
libfreetype6-dev \
libicu-dev \
libssl-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libedit-dev \
libedit2 \
libxslt1-dev \
apt-utils \
gnupg \
redis-tools \
mariadb-client\
git \
vim \
wget \
curl \
lynx \
psmisc \
unzip \
tar \
cron \
bash-completion \
&& apt-get clean
# Install Magento Dependencies
RUN docker-php-ext-configure \
gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/; \
docker-php-ext-install \
opcache \
gd \
bcmath \
intl \
mbstring \
pdo_mysql \
soap \
xsl \
zip
# Install oAuth
RUN apt-get update \
&& apt-get install -y \
libpcre3 \
libpcre3-dev \
# php-pear \
&& pecl install oauth \
&& echo "extension=oauth.so" > /usr/local/etc/php/conf.d/docker-php-ext-oauth.ini
# Install Node, NVM, NPM and Grunt
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - \
&& apt-get install -y nodejs build-essential \
&& curl https://raw.githubusercontent.com/creationix/nvm/v0.35.2/install.sh | sh \
&& npm i -g grunt-cli yarn
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer
RUN composer global require hirak/prestissimo
# Install Code Sniffer
RUN git clone https://github.com/magento/marketplace-eqp.git ~/.composer/vendor/magento/marketplace-eqp
RUN cd ~/.composer/vendor/magento/marketplace-eqp && composer install
RUN ln -s ~/.composer/vendor/magento/marketplace-eqp/vendor/bin/phpcs /usr/local/bin;
ENV PATH="/var/www/.composer/vendor/bin/:${PATH}"
# Install XDebug
RUN yes | pecl install xdebug && \
echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.iniOLD
# Install Mhsendmail
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install golang-go \
&& mkdir /opt/go \
&& export GOPATH=/opt/go \
&& go get github.com/mailhog/mhsendmail
# Install Magerun 2
RUN wget https://files.magerun.net/n98-magerun2.phar \
&& chmod +x ./n98-magerun2.phar \
&& mv ./n98-magerun2.phar /usr/local/bin/
# Configuring system
ADD .docker/config/php.ini /usr/local/etc/php/php.ini
ADD .docker/config/magento.conf /etc/apache2/sites-available/magento.conf
ADD .docker/config/custom-xdebug.ini /usr/local/etc/php/conf.d/custom-xdebug.ini
COPY .docker/bin/* /usr/local/bin/
COPY .docker/users/* /var/www/
RUN chmod +x /usr/local/bin/*
RUN ln -s /etc/apache2/sites-available/magento.conf /etc/apache2/sites-enabled/magento.conf
RUN curl -o /etc/bash_completion.d/m2install-bash-completion https://raw.githubusercontent.com/yvoronoy/m2install/master/m2install-bash-completion
RUN curl -o /etc/bash_completion.d/n98-magerun2.phar.bash https://raw.githubusercontent.com/netz98/n98-magerun2/master/res/autocompletion/bash/n98-magerun2.phar.bash
# RUN echo "source /etc/bash_completion" >> /root/.bashrc
# RUN echo "source /etc/bash_completion" >> /var/www/.bashrc
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn apt-key add - && \
echo "deb http://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && \
apt-get install --no-install-recommends yarn
RUN chmod 777 -Rf /var/www /var/www/.* \
&& chown -Rf www-data:www-data /var/www /var/www/.* \
&& usermod -u 1000 www-data \
&& chsh -s /bin/bash www-data\
&& a2enmod rewrite \
&& a2enmod headers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment