Skip to content

gyzo/docker-magento

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

meanbee/magento

Build Status Docker Build Status Docker Pulls Docker Stars

A collection of Docker images for running Magento application web servers and command line tools.

Supported tags and respective Dockerfile links

Usage

Since Magento requires several services working together, it recommended to use docker-compose with these images.

See docker-compose.yml for a sample configuration.

Options

Sendmail

All images have sendmail installed for emails, however it is not enabled by default. To enable sendmail, use the following environment variable:

ENABLE_SENDMAIL=true

Note: If sendmail has been enabled, make sure the container has a hostname assigned using the hostname field in docker-compose.yml or --hostname parameter for docker run. If the container does not have a hostname set, sendmail will attempt to discover the hostname on startup, blocking for a prolonged period of time.

Xdebug

Xdebug is installed and enabled on all the images by default. To configure it for remote debugging, start the container with the following environment variable set (replacing the {} placeholders with appropriate values):

XDEBUG_CONFIG="remote_connect_back=1 remote_enable=1 idekey={IDEKEY}"

Note: If you're using PhpStorm, your IDE Key is probably phpstorm.

Command Line Tools

The cli images have a number of useful Magento tools pre-installed:

  • composer - Install and manage PHP package dependencies
  • mageconfigsync - Backup and restore Magento System Configuration
  • magedbm - Create development backups of the Magento database using S3 and import them
  • magemm - Sync media images from an S3 backup
  • modman - Install Magento extensions
  • magerun - Run command line commands in Magento

All of the installed tools run in the working directory of the container, so don't forget to set it using the working_dir service configuration option in docker-compose.yml or the --workdir parameter to docker run.

Some of the commands use additional environment variables for configuration:

  • AWS_ACCESS_KEY_ID (magedbm, magemm) Credentials for S3 connections
  • AWS_SECRET_ACCESS_KEY (magedbm, magemm) Credentials for S3 connections
  • AWS_REGION (magedbm, magemm) S3 region to use
  • AWS_BUCKET (magedbm) S3 bucket to use for database backups
  • AWS_MEDIA_BUCKET (magemm) S3 bucket to fetch media images from

Building

A lot of the configuration for each image is the same, with the difference being the base image that they're extending from. For this reason we use php to build the Dockerfile from a set of templates in src/. The Dockerfile should still be published to the repository due to Docker Hub needing a Dockerfile to build from.

To build all Dockerfiles, run the builder.php script in the php:7 Docker image:

docker run --rm -it -v $(pwd):/src php:7 php /src/builder.php

Adding new images to the build config

The build configuration is controlled by the config.json file. Yeah element in the top level hash is a new build target, using the following syntax:

"<target-name>": {
    "version": "<php-version>",
    "flavour": "<image-flavour>",
    "files": {
        "<target-file-name>": {
            "<template-variable-name>": "<template-variable-value>",
            ...
        },
}

The target files will be rendered in the <php-version>/<image-flavour>/ directory.

The source template for each target file is selected from the src/ directory using the following fallback order:

  1. <target-file-name>-<php-version>-<image-flavour>
  2. <target-file-name>-<php-version>
  3. <target-file-name>-<image-flavour>
  4. <target-file-name>

Individual templates may include other templates as partials.

About

🐳 Docker containers with all required Magento dependencies installed available as Apache and CLI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dockerfile 56.5%
  • Shell 31.4%
  • PHP 12.1%