GithubHelp home page GithubHelp logo

guoyu07 / magento2-docker-compose Goto Github PK

View Code? Open in Web Editor NEW

This project forked from markshust/docker-magento

0.0 0.0 0.0 29 KB

This file is provided as an example development environment using Mage Inferno Magento 2 Docker Images.

License: MIT License

magento2-docker-compose's Introduction

This docker-compose.yml file is provided by Mage Inferno

Docker Hub

View our Docker Hub images at https://hub.docker.com/u/mageinferno/

Usage

This file is provided as an example development environment using Mage Inferno Magento 2 Docker Images.

Composer Setup

Uncomment the composer line from appdata to mount a .composer directory to the www-data user home directory. Please first setup Magento Marketplace authentication (details at http://devdocs.magento.com/guides/v2.0/install-gde/prereq/connect-auth.html).

Place your auth token at ~/.composer/auth.json with the following contents, like so:

{
    "http-basic": {
        "repo.magento.com": {
            "username": "MAGENTO_PUBLIC_KEY",
            "password": "MAGENTO_PRIVATE_KEY"
        }
    }
}

Then, just set M2SETUP_USE_ARCHIVE to false in your docker-compose.yml file.

Composer-less, No-Auth Setup

If you don't want to use Composer or setup the auth keys above, no worries. Mage Inferno install script uses Nexcess' hosted Magento archives for a Composer-less install process. Just set the M2SETUP_USE_ARCHIVE environment variable to true when running setup.

Running Setup

Using the above docker-compose.yml file, all you need to do is run one line to install Magento 2:

docker-compose run --rm setup

You may modify any environment variables depending on your requirements.

Data Volumes

Your Magento source data is persistently stored within Docker data volumes. For local development, we advise copying the entire contents of the appdata data volume to your local machine (after setup is complete of course). Since you shouldn't be modifying any of these files, this is just to bring the fully copy of the site back to your host:

docker cp CONTAINERID:/srv/www ./

Then, just uncomment the /www/app:/srv/www/app within your docker-compose.yml file (appdata > volumes) to mount your local app directory to the Docker data volume, then just restart your containers:

docker-compose up -d app

This will restart your container with app mounted from your host machine, so any edits to this directory will correctly sync with your Docker volume.

Running Magento CLI tool

We've setup scripts to aid in the running of Magento CLI tool with the correct permissions. To run the command line tool, you would connect as any other Docker Compose application would:

docker-compose exec phpfpm ./bin/magento

or with straight Docker command:

docker exec NAME_OF_PHPFPM_CONTAINER ./bin/magento

You can easily set these up as aliases inside your ~/.bash_profile file (or a similar script) as so:

alias magento='docker-compose exec phpfpm ./bin/magento'

This will allow you to clear the cache by running the following command right in terminal:

magento cache:flush

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.