diff --git a/.github/workflows/docker-image-magepack.yml b/.github/workflows/docker-image-magepack.yml new file mode 100644 index 00000000..989db75d --- /dev/null +++ b/.github/workflows/docker-image-magepack.yml @@ -0,0 +1,22 @@ +name: Docker Image Magepack +on: + schedule: + - cron: "0 6 * * 1" # 6 AM UTC on Monday + push: + paths: + - version + - images/.trigger + - images/magepack/** + branches: + - develop +jobs: + magepack: + name: Magepack + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - run: ./images/scripts/build.sh --push "${BUILD_GROUP}" + env: + BUILD_GROUP: magepack + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} diff --git a/commands/env-init.cmd b/commands/env-init.cmd index e3d5a141..70b6db41 100644 --- a/commands/env-init.cmd +++ b/commands/env-init.cmd @@ -76,6 +76,7 @@ if [[ "${WARDEN_ENV_TYPE}" == "magento2" ]]; then WARDEN_SPLIT_SALES=0 WARDEN_SPLIT_CHECKOUT=0 WARDEN_TEST_DB=0 + WARDEN_MAGEPACK=0 BLACKFIRE_CLIENT_ID= BLACKFIRE_CLIENT_TOKEN= diff --git a/commands/env.cmd b/commands/env.cmd index 0835e610..f7496fda 100644 --- a/commands/env.cmd +++ b/commands/env.cmd @@ -82,6 +82,9 @@ fi [[ ${WARDEN_SELENIUM} -eq 1 ]] \ && appendEnvPartialIfExists "selenium" +[[ ${WARDEN_MAGEPACK} -eq 1 ]] \ + && appendEnvPartialIfExists "${WARDEN_ENV_TYPE}.magepack" + if [[ -f "${WARDEN_ENV_PATH}/.warden/warden-env.yml" ]]; then DOCKER_COMPOSE_ARGS+=("-f") DOCKER_COMPOSE_ARGS+=("${WARDEN_ENV_PATH}/.warden/warden-env.yml") diff --git a/environments/magento2/magento2.magepack.base.yml b/environments/magento2/magento2.magepack.base.yml new file mode 100644 index 00000000..fb77e16d --- /dev/null +++ b/environments/magento2/magento2.magepack.base.yml @@ -0,0 +1,13 @@ +version: "3.5" +services: + magepack: + hostname: "${WARDEN_ENV_NAME}-magepack" + image: docker.io/wardenenv/magepack:${MAGEPACK_VERSION:-2.3} + environment: + - TRAEFIK_DOMAIN + - TRAEFIK_SUBDOMAIN + extra_hosts: + - ${TRAEFIK_DOMAIN}:${TRAEFIK_ADDRESS:-0.0.0.0} + - ${TRAEFIK_SUBDOMAIN:-app}.${TRAEFIK_DOMAIN}:${TRAEFIK_ADDRESS:-0.0.0.0} + depends_on: + - php-fpm diff --git a/environments/magento2/magento2.magepack.darwin.yml b/environments/magento2/magento2.magepack.darwin.yml new file mode 100644 index 00000000..f18c0187 --- /dev/null +++ b/environments/magento2/magento2.magepack.darwin.yml @@ -0,0 +1,8 @@ +version: "3.5" + +x-volumes: &volumes + - .${WARDEN_WEB_ROOT:-}/pub/media:/var/www/html/pub/media:delegated + - appdata:/var/www/html + +services: + magepack: { volumes: *volumes } diff --git a/environments/magento2/magento2.magepack.linux.yml b/environments/magento2/magento2.magepack.linux.yml new file mode 100644 index 00000000..0ce55331 --- /dev/null +++ b/environments/magento2/magento2.magepack.linux.yml @@ -0,0 +1,7 @@ +version: "3.5" + +x-volumes: &volumes + - .${WARDEN_WEB_ROOT:-}/:/var/www/html + +services: + magepack: { volumes: *volumes } diff --git a/images/magepack/2.3/Dockerfile b/images/magepack/2.3/Dockerfile new file mode 100644 index 00000000..a2df7d5f --- /dev/null +++ b/images/magepack/2.3/Dockerfile @@ -0,0 +1,13 @@ +FROM zenika/alpine-chrome:with-puppeteer + +USER root + +WORKDIR /var/www/html +COPY generate.sh /usr/bin/generate +COPY bundle.sh /usr/bin/bundle + +RUN npm install -g magepack@^2.3 && npm cache clean --force + +CMD tail -f /dev/null + +USER chrome diff --git a/images/magepack/context/bundle.sh b/images/magepack/context/bundle.sh new file mode 100755 index 00000000..dcaf2116 --- /dev/null +++ b/images/magepack/context/bundle.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +/usr/bin/magepack bundle diff --git a/images/magepack/context/generate.sh b/images/magepack/context/generate.sh new file mode 100755 index 00000000..ff76e9c6 --- /dev/null +++ b/images/magepack/context/generate.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +/usr/bin/magepack generate "$@"