Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save catalincezarene/56b6417978a516c880250b2e726bdbe1 to your computer and use it in GitHub Desktop.
Save catalincezarene/56b6417978a516c880250b2e726bdbe1 to your computer and use it in GitHub Desktop.
Install an Adobe Commerce on-premises project

Create a project using Composer OR

docker run \
  --rm \
  --interactive \
  --tty \
  --user $(id -u):$(id -g) \
  --volume $PWD:/app \
  composer sh -c '
    composer config \
      --global \
      --auth http-basic.repo.magento.com username password && \
    composer create-project \
      --ignore-platform-reqs \
      --repository-url=https://repo.magento.com/ \
      magento/project-enterprise-edition=2.3.3-p1 .
  '

Install an existing project

docker run \
  --rm \
  --interactive \
  --tty \
  --user $(id -u):$(id -g) \
  --volume $PWD:/app \
  composer sh -c '
    composer config \
      --global \
      --auth http-basic.repo.magento.com username password && \
    composer install \
      --ignore-platform-reqs
  '

Add the ece-tools and Cloud Docker for Commerce packages.

docker run \
  --rm \
  --interactive \
  --tty \
  --user $(id -u):$(id -g) \
  --volume $PWD:/app \
  composer sh -c '
    composer config \
      --global \
      --auth http-basic.repo.magento.com username password && \
    composer require \
      --ignore-platform-reqs \
      --dev \
      magento/ece-tools "^2002.1" \
      magento/magento-cloud-docker "^1.2"
  '

When you initialize a Adobe Commerce project for Docker development, you must create a .magento.docker.yml configuration source file to create the Docker containers for the local environment.

name: magento
system:
   mode: 'production'
services:
   php:
       version: '7.3'
       extensions:
           enabled:
               - xsl
               - json
               - redis
   mysql:
       version: '10.2'
       image: 'mariadb'
   redis:
       version: '5.0'
       image: 'redis'
   elasticsearch:
       version: '6.5'
hooks:
   build: |
       set -e
       php ./vendor/bin/ece-tools run scenario/build/generate.xml
       php ./vendor/bin/ece-tools run scenario/build/transfer.xml
   deploy: 'php ./vendor/bin/ece-tools run scenario/deploy.xml'
   post_deploy: 'php ./vendor/bin/ece-tools run scenario/post-deploy.xml'
mounts:
   var:
       path: 'var'
   app-etc:
       path: 'app/etc'
   pub-media:
       path: 'pub/media'
   pub-static:
       path: 'pub/static'

Create the Docker Compose configuration

docker run \
  --rm \
  --user $(id -u):$(id -g) \
  --volume $PWD:/app \
  php:7.3-cli /app/vendor/bin/ece-docker \
    build:compose \
      --mode="developer" \
      --host=magento2.test \
      --with-xdebug

Install Adobe Commerce

docker-compose run \
  --rm \
  deploy magento-command \
    setup:install \
      --admin-firstname=John \
      --admin-lastname=Smith \
      [email protected] \
      --admin-user=admin \
      --admin-password=password1 \
      --base-url=http://magento2.test/ \
      --db-host=db \
      --db-name=magento2 \
      --db-user=magento2 \
      --db-password=magento2 \
      --currency=USD \
      --timezone=America/Chicago \
      --language=en_US \
      --use-rewrites=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment