Giter Club home page Giter Club logo

magento-docker's Introduction

Magento 2 Docker

Docker container for Magento development based on richarvey/nginx-php-fpm image.

Specs

  • Alpine Linux 3.4.6
  • PHP 7.1.12
  • Nginx 1.13.7
  • MariaDB 10.2
  • Redis 3.2

Requirements

  • Git
  • Docker

Installation

  1. Clone the repository

    $ git clone [email protected]:lsrocha/magento-docker.git
    $ cd magento-docker
  2. Configure your services

    This project provides you sample config files. After cloning it, copy them and make the necessary changes.

    $ cp docker-compose.yml.sample docker-compose.yml
    $ cp config/nginx/default.conf.sample config/nginx/default.conf
  3. Import your code

    Import your Magento project into the resultant directory. Feel free to follow the best way for you, but be sure your project directory is called magento. For example, you can run: git clone [...] magento, mv [...] magento or even composer create-project [...] magento (following Magento installation doc).

    Inside Magento root directory, don't forget to copy nginx.conf.sample file to nginx.conf.

  4. Create docker containers

    $ docker-compose up -d

Now your store is available at http://store.local.

How to

Access container terminal

$ docker exec -it magento-docker_web_1 su dev -c bash

Listen to Nginx logs

$ docker logs -f magento-docker_web_1

Debug your application

Point your client/IDE to port 9000 and enable script debugging on your browser. Extensions for this purpose can be found in Xdebug documentation.

Configure multiple stores/websites

  1. Map your stores in config/nginx/default.conf

    map $http_host $MAGE_RUN_CODE {
        store.local default;
        storeview.local store1;
    }
    
    server {
        [...]
        server_name store.local storeview.local;
        [...]
        set $MAGE_RUN_TYPE store; # or website
        [...]
    }
  2. Edit your magento/.../nginx.conf

    location ~ (index|get|static|report|404|503|health_check)\.php$ {
        [...]
        fastcgi_param  MAGE_RUN_TYPE $MAGE_RUN_TYPE;
        fastcgi_param  MAGE_RUN_CODE $MAGE_RUN_CODE;
        include        fastcgi_params;
    }

magento-docker's People

Contributors

lsrocha avatar

Stargazers

 avatar Vitor Teofilo avatar  avatar

Watchers

James Cloos avatar

Forkers

scibel

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.