• This repository has been archived on 25/Jul/2023
  • Stars
    star
    456
  • Rank 95,985 (Top 2 %)
  • Language
    PHP
  • License
    MIT License
  • Created almost 9 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🐳 Docker containers with all required Magento 2 dependencies installed available as FPM through Nginx and CLI

Magento 2 Docker

Build Status Docker Build Status Docker Pulls Docker Stars

A collection of Docker images for running Magento 2 through nginx and on the command line.

Quick Start

cp composer.env.sample composer.env
# ..put the correct tokens into composer.env

mkdir magento

docker-compose run cli magento-installer
docker-compose up -d
docker-compose restart

Configuration

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.

  • PHP_MEMORY_LIMIT - The memory limit to be set in the php.ini
  • UPLOAD_MAX_FILESIZE - Upload filesize limit for PHP and Nginx
  • MAGENTO_RUN_MODE - Valid values, as defined in Magento\Framework\App\State: developer, production, default.
  • MAGENTO_ROOT - The directory to which Magento should be installed (defaults to /var/www/magento)
  • COMPOSER_GITHUB_TOKEN - Your GitHub OAuth token, should it be needed
  • COMPOSER_MAGENTO_USERNAME - Your Magento Connect public authentication key (how to get)
  • COMPOSER_MAGENTO_PASSWORD - Your Magento Connect private authentication key
  • COMPOSER_BITBUCKET_KEY - Optional - Your Bitbucket OAuth key (how to get)
  • COMPOSER_BITBUCKET_SECRET - Optional - Your Bitbucket OAuth secret
  • DEBUG - Toggles tracing in the bash commands when exectued; nothing to do with Magento`
  • PHP_ENABLE_XDEBUG - When set to true it will include the Xdebug ini file as part of the PHP configuration, turning it on. It's recommended to only switch this on when you need it as it will slow down the application.
  • UPDATE_UID_GID - If this is set to "true" then the uid and gid of www-data will be modified in the container to match the values on the mounted folders. This seems to be necessary to work around virtualbox issues on OSX.

A sample docker-compose.yml is provided in this repository.

CLI Usage

A number of commands are baked into the image and are available on the $PATH. These are:

  • magento-command - Provides a user-safe wrapper around the bin/magento command.
  • magento-installer - Installs and configures Magento into the directory defined in the $MAGENTO_ROOT environment variable.
  • magento-extension-installer - Installs a Magento 2 extension from the /extensions/<name> directory, using symlinks.
  • magerun2 - A user-safe wrapper for n98-magerun2.phar, which provides a wider range of useful commands. Learn more here

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.

CLI commands can be triggered by running:

docker-compose run cli magento-installer

Shell access to a CLI container can be triggered by running:

docker-compose run cli bash

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.

Implementation Notes

  • In order to achieve a sane environment for executing commands in, a docker-environment script is included as the ENTRYPOINT in the container.

xdebug Usage

To enable xdebug, you will need to toggle the PHP_ENABLE_XDEBUG environment variable to true in global.env. Then when using docker-compose you will need to restart the fpm container using docker-compose up -d, or stopping and starting the container.

Varnish

Varnish is running out of the container by default. If you do not require varnish, then you will need to remove the varnish block from your docker-compose.yml and uncomment the environment section under the web container definition.

To clear varnish, you can use the cli containers magento-command to clear the cache, which will include varnish. Alternatively, you could restart the varnish container.

docker-compose run --rm cli magento-command cache:flush
# OR
docker-compose restart varnish

If you need to add your own VCL, then it needs to be mounted to: /data/varnish.vcl.

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.

More Repositories

1

magento-meanbee-pwa

Progressive Web App extension for Magento 1
PHP
78
star
2

magecert

✏️ Jekyll repo for magecert.com, our online Magento Developer Certification notes.
CSS
72
star
3

Meanbee_CacheViewer

🔍 A Magento 1.x extension to analyse the contents of your cache.
PHP
71
star
4

docker-magento

🐳 Docker containers with all required Magento dependencies installed available as Apache and CLI
Dockerfile
68
star
5

gmailactions

A Magento extension for adding "actions" to emails in Gmail
PHP
57
star
6

magento2-serviceworker

Service Worker extension for Magento 2
PHP
52
star
7

magedbm

💾 Magento 1.x Database Backup Manager
PHP
39
star
8

magento-shopping-assistant

💁‍♂️ A Magento 1.x extension that uses TogetherJS to create a Virtual Shopping Assistant
PHP
37
star
9

slack-jira-bot

Provide URL expansion when Jira issues are mentioned in a Slack chat
Go
28
star
10

magento2-csspreload

Asynchronous CSS loading in Magento 2 using rel="preload"
JavaScript
28
star
11

magento-shipping-rules

Magento 1 extension that uses that power of promotion rules system to create flat rate shipping methods based on conditions
CSS
25
star
12

magento-mailcheck

Mailcheck integration with Magento for reducing user-misspelled email addresses in forms.
JavaScript
22
star
13

magento-estimateddelivery

Magento 1 Extension to provide delivery date estimates for each shipping method.
PHP
20
star
14

magento-coding-standards

Meanbee's coding standards for Magento
CSS
20
star
15

magento-cmspagerevisions

Maintain a history of CMS pages and static blocks in Magento 1 with this extension
PHP
20
star
16

magento2-webappmanifest

A Magento 2 extension that adds a Web App Manifest to the store.
PHP
19
star
17

royalmail

A Magento shipping extension to add Royal Mail shipping methods.
PHP
19
star
18

magento-admin-editable

A Magento extension to create static blocks on the fly through layout XML.
PHP
18
star
19

meanbee-magento-healthcheck

A framework for the implementation of proactive Magento health checks
PHP
17
star
20

Magento-SVG-Helper

Helper that allows you to echo SVG into markup from skin or media directory
PHP
16
star
21

download-remote-media

n98-magerun module to fetch remote product imagery.
PHP
15
star
22

magento2-svghelper

Simple module that provides a block level helper for reading in an SVG files source from a theme in Magento 2.
PHP
14
star
23

magento2-vip-membership

A VIP Membership extension for Magento 2
PHP
14
star
24

magento-infinite-scroll

Lazy load products on category and search results pages with our Infinite Scroll extension for Magento 1
JavaScript
14
star
25

magento-autocategories

This Magento 1 extension automatically manages categories for your new and sale products
PHP
13
star
26

magento-boilerplate-fe-build-tools

A workflow for conforming to Magento and frontend development standards
CSS
13
star
27

mage-test-orders

Quick PHP script to pump in some test orders into Magento.
PHP
12
star
28

magento-best-seller-sort

Add a "best selling" sort by method to your Magento 1 store with this extension
PHP
11
star
29

magento2-environment

Example of Meanbee's Environment Layout
Shell
10
star
30

ordershare

A Magento extension to share products from order success page.
PHP
10
star
31

company-contracts

A selection of our company legal agreement templates.
10
star
32

magento2-tax-rounding

Module to support backend entered excl. VAT and frontend incl. VAT pricing in Magento 2
PHP
10
star
33

docker-bastion

Docker bastion image with an SSH server and MySQL client installed.
Shell
9
star
34

product-quick-view

jQuery product quick view plugin.
CSS
9
star
35

barcodes

Magento extension that annotates order numbers, shipment numbers, product SKU codes, etc. with corresponding barcodes in administative views.
JavaScript
9
star
36

magento-theme-skeleton

A useful base for all Magento themes to build from
HTML
8
star
37

magento-diymage

Layout Management Extension for Magento 1
HTML
8
star
38

magento-homepage-per-theme

Specify a custom home page for each theme without needing to create store views.
PHP
7
star
39

magento2-infinitescroll

A Magento 2 extension for infinitely scrolling catalog pages
HTML
7
star
40

libmageconf

📚 Discover Magento (1.x or 2.x) configuration file without instantiating the framework
PHP
7
star
41

docker-magento-tools

Docker container that provides wrappers for composer, magerun, mageconfigsync and magedbm
Shell
7
star
42

magento-vipmembership

Magento 1 extension that provides a VIP product for people to purchase and that changes their customer group.
PHP
6
star
43

magedemo

A tool to allow for quick setup of demo sites for Magento extensions.
PHP
6
star
44

magento-amazon-s3-digital-delivery

Host downloadable products on Amazon S3 with this Magento 1 extension
PHP
6
star
45

magento-csrf-token-rotation

A Magento extension to rotate the frontend CSRF token on logging and logging out.
PHP
6
star
46

magentoboilerplate

A base Magento theme.
PHP
5
star
47

docker-magerun

Docker container that's a wrapper for n98-magerun
Shell
5
star
48

magento2-orderstatusaudit

A Magento 2 extension that provides an audit log for order status.
PHP
5
star
49

magento-meanbee-osd

Organisational Structured Data for Magento stores
PHP
5
star
50

magento2-royalmail

[No Longer Supported] A Royal Mail shipping integration for Magento 2.
PHP
5
star
51

magento-meanbee-core

Core Magento utility library
PHP
5
star
52

magerun-dac

Magerun command to duplicate and commit theme files
PHP
4
star
53

articles-to-podcast

Convert text articles to podcast feed.
PHP
4
star
54

Meanbee_Tinymce5

Add html5 support to tinymce editor
JavaScript
4
star
55

royalmail-php-library

PHP library for calculating Royal Mail shipping prices offline
PHP
3
star
56

mage_install

A tool to easily download the latest version of Magento to your working directory
3
star
57

magento-runrate

Forecast when stock will run out in order to inform stock ordering with our Inventory Run Rate extension for Magento 1
PHP
3
star
58

configsearch

A Magento extension that adds a search box to the Magento configuration area.
PHP
3
star
59

magento-configuration-powered-css

Generate CSS file per store based on Magento template. This is useful for CSS that's dependent on configuration, e.g. background images.
PHP
3
star
60

meanbee-corner-checkout

Magento 1 extension with an experimental cart that overlays the corner of the screen.
CSS
2
star
61

homebrew-tap

Meanbee's tool focused Homebrew tap
Ruby
2
star
62

rocketeer-magento

Magento plugin for Rocketeer
PHP
2
star
63

docker-magento-mysql

A Magento configured MySQL server image for Docker
1
star
64

magento-smartaddress

International Address Lookup solution for Magento 1 using PCA Predict
HTML
1
star
65

loaf-server

An example server for loaf
JavaScript
1
star
66

magentonotmagneto

The infamous.
HTML
1
star
67

responsive-email-build-tools

Tools to help build responsive emails
CSS
1
star
68

docker-mageconfigsync

A Docker container that's a wrapper for mageconfigsync
Shell
1
star
69

docker-nginx-proxy

Automated Nginx proxy for Docker
1
star
70

example-magento2-module

An example of Meanbee's Magento2 Module Structure
PHP
1
star
71

full-window-modal

Responsive Full window modal to be used on images.
CSS
1
star
72

loaf

A simple way to share single file scripts
Python
1
star
73

docker-magedbm

Docker container that's a wrapper for magedbm
Shell
1
star
74

poddle

The podcast transcriber and concept based search service using IBM Watson
PHP
1
star
75

magento-feedback

Add a feedback form to the customer success page with this Magento 1 extension
HTML
1
star
76

magento-stocklevels

Provide a visual indication of stock available for each option of a configurable product with this Magento 1 extension
PHP
1
star