Skip to content

Instantly share code, notes, and snippets.

@shiftedreality
Last active November 13, 2019 18:48
Show Gist options
  • Save shiftedreality/6c274febaa9289c15589efa2e9d2320e to your computer and use it in GitHub Desktop.
Save shiftedreality/6c274febaa9289c15589efa2e9d2320e to your computer and use it in GitHub Desktop.
Local development of Magento Cloud Docker

Developing Compose Builders

To be able to test changes to Cloud Docker, create next file:

#!/usr/bin/env php
<?php

require __DIR__ . '/../bootstrap.php';

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\Config\FileLocator;
use Magento\CloudDocker\Filesystem\DirectoryList;

$container = new ContainerBuilder();
$container->set(DirectoryList::class, new DirectoryList(
    dirname(__DIR__),
    __DIR__ . '/../../YOUR_PROJECT',
    __DIR__ . '/../../YOUR_PROJECT'
));

$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../config'));
$loader->load('services.xml');

$container->compile();

$application = new Magento\CloudDocker\Application($container);
$application->run();
  • Replace YOUR_PROJECT with folder name to your Cloud Project
  • And save it as ./bin/dev-ece-docker:

So your projects structure woluld be:

-- YOUR_PROJECT
-- magento-cloud-docker/bin/dev-ece-docker

Developing images

If you made a changes to images and want to test, just build them locally:

Assuming you're in your Cloud Project's directory:

docker build -t test/php:7.2-fpm ../magento-cloud-docker/images/php/7.2-fpm \
  && docker build -t test/php:7.2-cli ../magento-cloud-docker/images/php/7.2-cli

This command will build 2 images (PHP-CCLI and PHP-FPM) locally.

To use them - replace original images in your docker-compose.yml file:

  build:
    image: 'magento/magento-cloud-docker-php:7.2-cli-1.0'
    // Rest content

TO

  build:
    image: 'test/php:7.2-cli'

Do the same for all other PHP-* occurences

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment