Skip to content

Instantly share code, notes, and snippets.

@georanma
Created March 20, 2019 20:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save georanma/ffe090720903fc5211aed9d96fc2848c to your computer and use it in GitHub Desktop.
Save georanma/ffe090720903fc5211aed9d96fc2848c to your computer and use it in GitHub Desktop.
Docker Magento 1 w/ Xdebug
version: '2'
services:
nginx:
image: nginx:latest
ports:
- "8880:80"
volumes:
- ./:/source
- ./nginx.conf:/etc/nginx/conf.d/default.conf
php:
build: ./php
volumes:
- ./:/source
db:
image: mariadb:latest
ports:
- "3306:3306"
environment:
MYSQL_DATABASE: 'magento'
MYSQL_USER: 'magento'
MYSQL_PASSWORD: 'magento'
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
magerun:
image: meanbee/magerun
environment:
MAGE_ROOT_DIR: /source
links:
- db
volumes:
- ./:/source
FROM php:7.2-fpm
RUN apt-get -qq update && apt-get -qq install libxml++2.6-dev > /dev/null
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
zlib1g-dev \
libicu-dev \
g++ \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd mbstring mysqli pdo pdo_mysql soap
RUN apt-get install -y libmcrypt-dev
RUN apt-get install -y libicu-dev
RUN docker-php-ext-configure intl
RUN docker-php-ext-install intl
RUN apt-get install --no-install-recommends --assume-yes --quiet ca-certificates curl git &&\
rm -rf /var/lib/apt/lists/*
RUN curl -Lsf 'https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz' | tar -C '/usr/local' -xvzf -
ENV PATH /usr/local/go/bin:$PATH
RUN go get github.com/mailhog/mhsendmail
RUN cp /root/go/bin/mhsendmail /usr/bin/mhsendmail
RUN echo 'sendmail_path = /usr/bin/mhsendmail --smtp-addr mailhog:1025' > /usr/local/etc/php/php.ini
RUN pecl install xdebug-2.6.0 && docker-php-ext-enable xdebug
RUN echo 'zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so"' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.remote_port=9000' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.remote_enable=1' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.remote_connect_back=1' >> /usr/local/etc/php/php.ini
server {
index index.php index.html;
server_name localhost;
error_log /var/log/nginx/error.log warn;
access_log /var/log/nginx/access.log;
root /source;
location / {
try_files $uri $uri/ @handler;
}
location @handler {
rewrite / /index.php;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PHP_VALUE "memory_limit = 1000M";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment