From b0fbeda8eeb8a1be7d3d0e9ed5aebcc415358121 Mon Sep 17 00:00:00 2001 From: Jack Barton Date: Tue, 16 Jun 2020 11:47:27 +0100 Subject: [PATCH 1/3] Remove web writable generated directory for M2 if production --- src/magento2/harness.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/magento2/harness.yml b/src/magento2/harness.yml index 94c245a89..7d384db16 100644 --- a/src/magento2/harness.yml +++ b/src/magento2/harness.yml @@ -23,7 +23,7 @@ attributes: - '/app/pub/static' - '/app/var' - '/app/pub/static/frontend' - - '/app/generated' + - "= (@('app.mode') !== 'production' ? '/app/generated' : '')" services: - chrome - cron From 14ae44085155572028a7447722c1a390d6134a54 Mon Sep 17 00:00:00 2001 From: Jack Barton Date: Tue, 16 Jun 2020 11:48:40 +0100 Subject: [PATCH 2/3] Configure MAGE_MODE --- .../docker/image/console/Dockerfile.twig | 36 +++++++++++++++++++ src/magento2/harness/attributes/docker.yml | 1 + 2 files changed, 37 insertions(+) create mode 100644 src/magento2/docker/image/console/Dockerfile.twig diff --git a/src/magento2/docker/image/console/Dockerfile.twig b/src/magento2/docker/image/console/Dockerfile.twig new file mode 100644 index 000000000..1c447bc4f --- /dev/null +++ b/src/magento2/docker/image/console/Dockerfile.twig @@ -0,0 +1,36 @@ +FROM {{ @('docker.image.console') }} + +COPY .my127ws/docker/image/console/root / +RUN chown -R build:build /home/build \ + && curl -L -o /usr/local/bin/mhsendmail -sS -f https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64 \ + && chmod +x /usr/local/bin/mhsendmail + +ENV APP_MODE={{ @('app.mode') }} \ + APP_BUILD={{ @('app.build') }} \ + ASSETS_DIR={{ @('assets.local') }} \ + MAGE_MODE={{ (@('app.mode') == 'production') ? 'production' : 'developer' }} + +{% if @('node.version') is not null %} +USER build +RUN . /home/build/.nvm/nvm.sh \ + && nvm install {{ @('node.version') }} \ + && nvm use {{ @('node.version') }} \ + && nvm alias default {{ @('node.version') }} \ + && npm install -g yarn +USER root +{% endif %} + +{% if @('app.build') == 'static' %} +RUN chown build:build /app +COPY --chown=build:build .my127ws/application /home/build/application +COPY --chown=build:build ./ /app +USER build +RUN app build +USER root +{% else %} +VOLUME /app +VOLUME /home/build/application +{% endif %} + +ENTRYPOINT ["/entrypoint.sh"] +CMD ["sleep", "infinity"] diff --git a/src/magento2/harness/attributes/docker.yml b/src/magento2/harness/attributes/docker.yml index 3ebbc62b2..3f9b004e6 100644 --- a/src/magento2/harness/attributes/docker.yml +++ b/src/magento2/harness/attributes/docker.yml @@ -3,6 +3,7 @@ attributes: php-base: environment: MAGENTO_CRYPT_KEY: = @('magento.crypt.key') + MAGE_MODE: "= (@('app.mode') == 'production') ? 'production' : 'developer')" pipeline: preview: persistence: From 0b8eca2ad2a37ea9fb5a10efe11e25b2a503f722 Mon Sep 17 00:00:00 2001 From: Jack Barton Date: Tue, 16 Jun 2020 12:13:30 +0100 Subject: [PATCH 3/3] Update src/magento2/harness/attributes/docker.yml Co-authored-by: Kieren Evans --- src/magento2/harness/attributes/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/magento2/harness/attributes/docker.yml b/src/magento2/harness/attributes/docker.yml index 3f9b004e6..176457e28 100644 --- a/src/magento2/harness/attributes/docker.yml +++ b/src/magento2/harness/attributes/docker.yml @@ -3,7 +3,7 @@ attributes: php-base: environment: MAGENTO_CRYPT_KEY: = @('magento.crypt.key') - MAGE_MODE: "= (@('app.mode') == 'production') ? 'production' : 'developer')" + MAGE_MODE: "= (@('app.mode') == 'production' ? 'production' : 'developer')" pipeline: preview: persistence: