|
| 1 | +#Magento 2 Docker |
| 2 | + |
| 3 | +## Quick Start |
| 4 | + |
| 5 | + cp composer.env.sample composer.env |
| 6 | + # ..put the correct tokens into composer.env |
| 7 | + |
| 8 | + docker-compose run cli magento-installer |
| 9 | + docker-compose up -d |
| 10 | + docker-compose restart |
| 11 | + |
| 12 | +## Configuration |
| 13 | + |
| 14 | +Configuration is driven through environment variables. A comprehensive list of the environment variables used can be found in each `Dockerfile` and the commands in each `bin/` directory. |
| 15 | + |
| 16 | +* `PHP_MEMORY_LIMIT` - The memory limit to be set in the `php.ini` |
| 17 | +* `MAGENTO_ROOT` - The directory to which Magento should be installed |
| 18 | +* `MAGENTO_RUN_MODE` - Valid values, as defined in `Magento\Framework\App\State`: `developer`, `production`, `default`. |
| 19 | +* `COMPOSER_GITHUB_TOKEN` - Your [GitHub OAuth token](https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens), should it be needed |
| 20 | +* `COMPOSER_MAGENTO_USERNAME` - Your Magento Connect public authentication key ([how to get](http://devdocs.magento.com/guides/v2.0/install-gde/prereq/connect-auth.html)) |
| 21 | +* `COMPOSER_MAGENTO_PASSWORD` - Your Magento Connect private authentication key |
| 22 | +* `DEBUG` - Toggles tracing in the bash commands when exectued; nothing to do with Magento` |
| 23 | +* `IS_OSX` - If this is set to "true" then the uid and gid of `www-data` will be modified in the container |
| 24 | + |
| 25 | +A sample `docker-compose.yml` is provided in this repository. |
| 26 | + |
| 27 | +## CLI Usage |
| 28 | + |
| 29 | +A number of commands are baked into the image and are available on the `$PATH`. These are: |
| 30 | + |
| 31 | +* `magento-command` - Provides a user-safe wrapper around the `bin/magento` command. |
| 32 | +* `magento-installer` - Installs and configures Magento into the directory defined in the `$MAGENTO_ROOT` environment variable. |
| 33 | + |
| 34 | +It's recommended that you mount an external folder to `/root/.composer/cache`, otherwise you'll be waiting all day for Magento to download every time the container is booted. |
| 35 | + |
| 36 | +CLI commands can be triggered by running: |
| 37 | + |
| 38 | + docker-compose run cli magento-installer |
| 39 | + |
| 40 | +Shell access to a CLI container can be triggered by running: |
| 41 | + |
| 42 | + docker-compose run cli bash |
| 43 | + |
| 44 | +## Implementation Notes |
| 45 | + |
| 46 | +* In order to achieve a sane environment for executing commands in, a `docker-environment` script is included as the `ENTRYPOINT` in the container. |
| 47 | + |
| 48 | +## Credits |
| 49 | + |
| 50 | +Thanks to [Mark Shust](https://twitter.com/markshust) for his work on [docker-magento2-php](https://github.com/mageinferno/docker-magento2-php) that was used as a basis for this implementation. You solved a lot of the problems so I didn't need to! |
0 commit comments