Magento: 2.4.8-p3 Community Edition
Magento Cloud Docker: 1.4.5
- Docker
- Mutagen
- Magento's access credentials
-
Clone magento cloud docker repository.
git clone https://github.com/magento/magento-cloud-docker.git
-
Change current working directory to magento cloud docker.
cd magento-cloud-docker -
Build docker images.
docker image build --platform=linux/arm64/v8 -t magento/magento-cloud-docker-php:8.4-cli-1.4.5 ./images/php/8.4-cli docker image build --platform=linux/arm64/v8 -t magento/magento-cloud-docker-opensearch:3-1.4.5 ./images/opensearch/3 docker image build --platform=linux/arm64/v8 -t magento/magento-cloud-docker-nginx:1.28-1.4.5 ./images/nginx/1.28 docker image build --platform=linux/arm64/v8 -t magento/magento-cloud-docker-varnish:7.7-1.4.5 ./images/varnish/7.7
-
Create directory where you want to install Magento Cloud Docker.
-
Change to the new project directory.
-
Create composer project based on
magento/project-community-edition. Replace<public-key>:<private-key>with your access credentialsdocker run --rm -v "$(pwd)":/m2 "magento/magento-cloud-docker-php:8.4-cli-1.4.5" composer create-project --repository-url=https://<public-key>:<private-key>@repo.magento.com/ magento/project-community-edition=2.4.8-p3 /m2 -
Add your access credentials to the auth.json file.
{ "http-basic": { "repo.magento.com": { "username": "<public-key>", "password": "<private-key>" } } } -
Add the ece-tools and Cloud Docker for Commerce packages.
docker run --rm -v "$(pwd)":/m2 "magento/magento-cloud-docker-php:8.4-cli-1.4.5" composer require --working-dir=/m2 --no-update --dev magento/ece-tools magento/magento-cloud-docker -
Create the default configuration source file, .magento.docker.yml to build the Docker containers for the local environment.
name: magento system: mode: 'developer' services: php: version: '8.4' extensions: enabled: - xsl - json - redis mysql: version: '11.4' image: 'mariadb' redis: version: '7.2' image: 'redis' opensearch: version: '3' image: 'magento/magento-cloud-docker-opensearch' 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'
-
Update project.
docker run --rm -v "$(pwd)":/m2 "magento/magento-cloud-docker-php:8.4-cli-1.4.5" composer update --working-dir=/m2 -
In your local project root, generate the Docker Compose configuration file with mutagen used for synchronizing data in Docker.
docker run --rm -v "$(pwd)":/m2 "magento/magento-cloud-docker-php:8.4-cli-1.4.5" /m2/vendor/bin/ece-docker build:compose --mode="developer" --sync-engine="mutagen" -
Copy the default configuration DIST file to your custom configuration file and make any necessary changes.
cp .docker/config.php.dist .docker/config.php
-
Build files to containers and run in the background.
docker compose up -d -
Start the file synchronisation. When using docker compose instead of docker-compose ensure that contents of mutagen.sh were updated accordingly as they are still using old format of docker compose.
bash ./mutagen.sh
-
Make sure file synchronisation has completed.
mutagen sync listCheck for status of each sync, when finished it will say under each sync session:
Status: Watching for changes
- Deploy Adobe Commerce in the Docker container.
docker compose run --rm deploy cloud-deploy - Run post-deploy hooks.
docker compose run --rm deploy cloud-post-deploy - Configure and connect Varnish.
docker compose run --rm deploy magento-command config:set system/full_page_cache/caching_application 2 --lock-envdocker compose run --rm deploy magento-command setup:config:set --http-cache-hosts=varnish --no-interaction - Clear the cache.
docker compose run --rm deploy magento-command cache:clean
Access the local storefront by opening the following URL in a browser:
https://magento2.docker
Access the local admin dashboard by opening the following URL in a browser: https://magento2.docker/admin
docker compose run --rm deploy magento-command sampledata:deploy
docker compose run --rm deploy magento-command setup:upgrade
Now that Hyva Theme is officially open-sourced you can easily install it.
Get a free key by registering an account at hyva.io and creating one from your account dashboard.
docker compose run --rm deploy composer config repositories.private-packagist composer https://hyva-themes.repo.packagist.com/magento2-docke-XXXXX/
docker compose run --rm deploy composer config --global --auth http-basic.hyva-themes.repo.packagist.com token XXXXX
Unfortunately Hyva Checkout is still a paid-for add-on so if you want to have a functional checkout you will need to install Luma Checkout fallback.
docker compose run --rm deploy composer require hyva-themes/magento2-default-theme hyva-themes/magento2-luma-checkout
docker compose run --rm deploy magento-command mo:di Magento_TwoFactorAuth Magento_AdminAdobeImsTwoFactorAuth
docker compose run --rm deploy magento-command setup:upgrade
Navigate to the Content > Design > Configuration admin section and activate the hyva/default theme on a Website level.
docker compose run --rm deploy magento-command cache:clean
docker compose run --rm deploy magento-command cache:flush
Based on: https://developer.adobe.com/commerce/cloud-tools/docker/deploy/developer-mode/ https://docs.hyva.io/hyva-themes/getting-started/index.html#getting-started