diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a26d72ab..aee82958 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -44,12 +44,7 @@ jobs: if: ${{ github.event_name == 'pull_request' }} working-directory: base - - name: Base Images > Docker Build & Push - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && steps.changes.outputs.base != 'true' }} - run: ./docker_tags.sh -p - working-directory: base - - - name: Base Images > Docker Build & Push + - name: Base Images > Docker Build & Force Push if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && steps.changes.outputs.base == 'true' }} run: ./docker_tags.sh -p -f working-directory: base diff --git a/Dockerfile-branch.model b/Dockerfile-branch.model index 4c812ea7..6b2b356e 100644 --- a/Dockerfile-branch.model +++ b/Dockerfile-branch.model @@ -4,6 +4,6 @@ LABEL maintainer="PrestaShop Core Team " RUN apt update RUN apt -y install git -RUN git clone -b $branch_version https://github.com/PrestaShop/PrestaShop.git /tmp/data-ps +ENV PS_BRANCH=$branch_version -CMD ["/tmp/docker_run.sh"] +CMD ["/tmp/docker_branch_run.sh"] diff --git a/HOW-TO-USE.md b/HOW-TO-USE.md index 11a50499..2c127907 100644 --- a/HOW-TO-USE.md +++ b/HOW-TO-USE.md @@ -111,3 +111,46 @@ $ nosetests --with-id 7 ``` This will also generate a `.nodeids` binary file, when you add new test methods you need to remove this file to re-generate the list of IDs. + +## Building and running PrestaShop docker locally + +First to make sure you will use the local docker containers and not the ones from Docker hub make sure you remove all existing PrestaShop images (including the base images) + +``` +# This should be empty to be extra sure +$ docker images +``` + +Then you'll have to build the base image for the PHP version and server you are willing to use. If you are on MacOS this is crucial that you clean any image from cache and tun this locally, +especially if your architecture is based on linux/arm64 (processor M1, M2, ...). + +```shell +docker build base/images/8.3-apache -t prestashop/base:8.3-apache +# You should see an image with Repository: prestashop Tag: 8.3-apache +docker images +``` + +Then you can build the image of the PrestaShop version you want to use: + +``` +# Now build the PrestaShop version you want based on this local base image +$ docker build images/9.0.x/8.3-apache -t prestashop/prestashop:9.0.x-8.3-apache +``` + +Finally, you can launch your PrestaShop container using docker compose + +``` +$ PS_VERSION=9.0.x PHP_VERSION=8.3 docker compose -f images/docker-compose.yml up +``` + +Or you can use this script that performs these actions based on the arguments + +``` +# Default values are nightly 8.3 apache +./build-local-docker.sh 9.0.x 8.1 fpm +``` + +Now you should be able to access a shop at this address: `http://localhost:8001/` +The BO is accessible at `http://localhost:8001/admin-dev` with the following login: +Email: `demo@prestashop.com` +Password: `Correct Horse Battery Staple` diff --git a/base/Dockerfile.model b/base/Dockerfile.model index 6f7328d3..a0f3b7e8 100644 --- a/base/Dockerfile.model +++ b/base/Dockerfile.model @@ -50,7 +50,7 @@ RUN docker-php-source extract \ && docker-php-source delete # Prepare install and CMD script -COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh /tmp/ +COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh config_files/docker_branch_run.sh /tmp/ # If handle dynamic domain COPY config_files/docker_updt_ps_domains.php /tmp/ diff --git a/base/README.md b/base/README.md new file mode 100644 index 00000000..bde5ba47 --- /dev/null +++ b/base/README.md @@ -0,0 +1,27 @@ +### Creating new base images + +To add new base versions update the `tags.txt` file to add a new version of PHP (usually one for apache and one for fpm) + +Then run the generation script: + +``` +$ ./generate_tags.sh +``` + +If you wan to force the regeneration of existing base images force it: + +```shell +$ ./generate_tags.sh -f +``` + +But be careful, for image with PHP <7.4 the installation of GD is different be careful not to remove this special line: + +``` +# Not this line: +RUN docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ --with-webp=/usr/include + +But those lines instead: + +# PHP < 7.4 have an old syntax to install GD. See https://github.com/docker-library/php/issues/912 +RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-webp-dir=/usr/include +``` diff --git a/base/config_files/docker_branch_run.sh b/base/config_files/docker_branch_run.sh new file mode 100755 index 00000000..7a24ceb8 --- /dev/null +++ b/base/config_files/docker_branch_run.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +# Clone repository +if [ ! -f /var/www/html/composer.json ]; then + echo Clone PrestaShop $PS_BRANCH + git clone -b $PS_BRANCH https://github.com/PrestaShop/PrestaShop.git /var/www/html + chown -R www-data:www-data /var/www/html +fi + +# Install composer +if [ ! -f /usr/local/bin/composer ]; then + echo "\n* Install composer ..."; + mkdir -p /var/www/.composer + chown -R www-data:www-data /var/www/.composer + runuser -g www-data -u www-data -- php -r "copy('https://getcomposer.org/installer', '/tmp/composer-setup.php');" && php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer && rm -rf /tmp/composer-setup.php + if [ ! -f /usr/local/bin/composer ]; then + echo Composer installation failed + exit 1 + fi +fi + +# Install vendor dependencies +if [ ! -f /var/www/html/vendor/autoload.php ]; then + echo "\n* Running composer ..."; + pushd /var/www/html + # Execute composer as default user so that we can set the env variables to increase timeout, also disable default_socket_timeout for php + COMPOSER_PROCESS_TIMEOUT=600 COMPOSER_IPRESOLVE=4 php -ddefault_socket_timeout=-1 /usr/local/bin/composer install --ansi --prefer-dist --no-interaction --no-progress + # Update the owner of composer installed folders to be www-data + chown -R www-data:www-data vendor modules themes + popd +fi + +# Build assets +if [ "${DISABLE_MAKE}" != "1" ]; then + mkdir -p /var/www/.npm + chown -R www-data:www-data /var/www/.npm + + echo "\n* Install node $NODE_VERSION..."; + export NVM_DIR=/usr/local/nvm + mkdir -p $NVM_DIR \ + && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash \ + && . $NVM_DIR/nvm.sh \ + && nvm install $NODE_VERSION \ + && nvm alias default $NODE_VERSION \ + && nvm use default + + export NODE_PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin + export PATH=$PATH:$NODE_PATH + + pushd /var/www/html + echo "\n* Build assets ..."; + runuser -g www-data -u www-data -- /usr/bin/make assets + + echo "\n* Wait for assets built..."; + runuser -g www-data -u www-data -- /usr/bin/make wait-assets + popd +else + echo "\n* Build of assets was disabled..."; +fi + +/tmp/docker_run.sh diff --git a/base/config_files/docker_run.sh b/base/config_files/docker_run.sh index 1d239c72..6ae4c6c7 100755 --- a/base/config_files/docker_run.sh +++ b/base/config_files/docker_run.sh @@ -89,7 +89,7 @@ if [ ! -f ./config/settings.inc.php ] && [ ! -f ./install.lock ]; then runuser -g www-data -u www-data -- php -d memory_limit=-1 /var/www/html/$PS_FOLDER_INSTALL/index_cli.php \ --domain="$PS_DOMAIN" --db_server=$DB_SERVER:$DB_PORT --db_name="$DB_NAME" --db_user=$DB_USER \ --db_password=$DB_PASSWD --prefix="$DB_PREFIX" --firstname="John" --lastname="Doe" \ - --password=$ADMIN_PASSWD --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ + --password="$ADMIN_PASSWD" --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ --all_languages=$PS_ALL_LANGUAGES --newsletter=0 --send_email=0 --ssl=$PS_ENABLE_SSL if [ $? -ne 0 ]; then diff --git a/base/generate_tags.sh b/base/generate_tags.sh index 24aa434f..7b7873eb 100755 --- a/base/generate_tags.sh +++ b/base/generate_tags.sh @@ -31,6 +31,7 @@ generate_image() if [ -d images/$folder ] && [ -z "$FORCE" ]; then # Do not erase what we already defined in the directory + echo Already defined, skipping Use -f to forcre update return fi diff --git a/base/images/7.1-apache/Dockerfile b/base/images/7.1-apache/Dockerfile index c4eb0a87..e164c35e 100644 --- a/base/images/7.1-apache/Dockerfile +++ b/base/images/7.1-apache/Dockerfile @@ -51,7 +51,7 @@ RUN docker-php-source extract \ && docker-php-source delete # Prepare install and CMD script -COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh /tmp/ +COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh config_files/docker_branch_run.sh /tmp/ # If handle dynamic domain COPY config_files/docker_updt_ps_domains.php /tmp/ diff --git a/base/images/7.1-apache/config_files/docker_branch_run.sh b/base/images/7.1-apache/config_files/docker_branch_run.sh new file mode 100755 index 00000000..7a24ceb8 --- /dev/null +++ b/base/images/7.1-apache/config_files/docker_branch_run.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +# Clone repository +if [ ! -f /var/www/html/composer.json ]; then + echo Clone PrestaShop $PS_BRANCH + git clone -b $PS_BRANCH https://github.com/PrestaShop/PrestaShop.git /var/www/html + chown -R www-data:www-data /var/www/html +fi + +# Install composer +if [ ! -f /usr/local/bin/composer ]; then + echo "\n* Install composer ..."; + mkdir -p /var/www/.composer + chown -R www-data:www-data /var/www/.composer + runuser -g www-data -u www-data -- php -r "copy('https://getcomposer.org/installer', '/tmp/composer-setup.php');" && php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer && rm -rf /tmp/composer-setup.php + if [ ! -f /usr/local/bin/composer ]; then + echo Composer installation failed + exit 1 + fi +fi + +# Install vendor dependencies +if [ ! -f /var/www/html/vendor/autoload.php ]; then + echo "\n* Running composer ..."; + pushd /var/www/html + # Execute composer as default user so that we can set the env variables to increase timeout, also disable default_socket_timeout for php + COMPOSER_PROCESS_TIMEOUT=600 COMPOSER_IPRESOLVE=4 php -ddefault_socket_timeout=-1 /usr/local/bin/composer install --ansi --prefer-dist --no-interaction --no-progress + # Update the owner of composer installed folders to be www-data + chown -R www-data:www-data vendor modules themes + popd +fi + +# Build assets +if [ "${DISABLE_MAKE}" != "1" ]; then + mkdir -p /var/www/.npm + chown -R www-data:www-data /var/www/.npm + + echo "\n* Install node $NODE_VERSION..."; + export NVM_DIR=/usr/local/nvm + mkdir -p $NVM_DIR \ + && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash \ + && . $NVM_DIR/nvm.sh \ + && nvm install $NODE_VERSION \ + && nvm alias default $NODE_VERSION \ + && nvm use default + + export NODE_PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin + export PATH=$PATH:$NODE_PATH + + pushd /var/www/html + echo "\n* Build assets ..."; + runuser -g www-data -u www-data -- /usr/bin/make assets + + echo "\n* Wait for assets built..."; + runuser -g www-data -u www-data -- /usr/bin/make wait-assets + popd +else + echo "\n* Build of assets was disabled..."; +fi + +/tmp/docker_run.sh diff --git a/base/images/7.1-apache/config_files/docker_run.sh b/base/images/7.1-apache/config_files/docker_run.sh index ea4faa82..5256a5a7 100755 --- a/base/images/7.1-apache/config_files/docker_run.sh +++ b/base/images/7.1-apache/config_files/docker_run.sh @@ -89,7 +89,7 @@ if [ ! -f ./config/settings.inc.php ] && [ ! -f ./install.lock ]; then runuser -g www-data -u www-data -- php -d memory_limit=-1 /var/www/html/$PS_FOLDER_INSTALL/index_cli.php \ --domain="$PS_DOMAIN" --db_server=$DB_SERVER:$DB_PORT --db_name="$DB_NAME" --db_user=$DB_USER \ --db_password=$DB_PASSWD --prefix="$DB_PREFIX" --firstname="John" --lastname="Doe" \ - --password=$ADMIN_PASSWD --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ + --password="$ADMIN_PASSWD" --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ --all_languages=$PS_ALL_LANGUAGES --newsletter=0 --send_email=0 --ssl=$PS_ENABLE_SSL if [ $? -ne 0 ]; then diff --git a/base/images/7.1-fpm/Dockerfile b/base/images/7.1-fpm/Dockerfile index edeff118..d2fedc44 100644 --- a/base/images/7.1-fpm/Dockerfile +++ b/base/images/7.1-fpm/Dockerfile @@ -51,7 +51,7 @@ RUN docker-php-source extract \ && docker-php-source delete # Prepare install and CMD script -COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh /tmp/ +COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh config_files/docker_branch_run.sh /tmp/ # If handle dynamic domain COPY config_files/docker_updt_ps_domains.php /tmp/ diff --git a/base/images/7.1-fpm/config_files/docker_branch_run.sh b/base/images/7.1-fpm/config_files/docker_branch_run.sh new file mode 100755 index 00000000..7a24ceb8 --- /dev/null +++ b/base/images/7.1-fpm/config_files/docker_branch_run.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +# Clone repository +if [ ! -f /var/www/html/composer.json ]; then + echo Clone PrestaShop $PS_BRANCH + git clone -b $PS_BRANCH https://github.com/PrestaShop/PrestaShop.git /var/www/html + chown -R www-data:www-data /var/www/html +fi + +# Install composer +if [ ! -f /usr/local/bin/composer ]; then + echo "\n* Install composer ..."; + mkdir -p /var/www/.composer + chown -R www-data:www-data /var/www/.composer + runuser -g www-data -u www-data -- php -r "copy('https://getcomposer.org/installer', '/tmp/composer-setup.php');" && php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer && rm -rf /tmp/composer-setup.php + if [ ! -f /usr/local/bin/composer ]; then + echo Composer installation failed + exit 1 + fi +fi + +# Install vendor dependencies +if [ ! -f /var/www/html/vendor/autoload.php ]; then + echo "\n* Running composer ..."; + pushd /var/www/html + # Execute composer as default user so that we can set the env variables to increase timeout, also disable default_socket_timeout for php + COMPOSER_PROCESS_TIMEOUT=600 COMPOSER_IPRESOLVE=4 php -ddefault_socket_timeout=-1 /usr/local/bin/composer install --ansi --prefer-dist --no-interaction --no-progress + # Update the owner of composer installed folders to be www-data + chown -R www-data:www-data vendor modules themes + popd +fi + +# Build assets +if [ "${DISABLE_MAKE}" != "1" ]; then + mkdir -p /var/www/.npm + chown -R www-data:www-data /var/www/.npm + + echo "\n* Install node $NODE_VERSION..."; + export NVM_DIR=/usr/local/nvm + mkdir -p $NVM_DIR \ + && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash \ + && . $NVM_DIR/nvm.sh \ + && nvm install $NODE_VERSION \ + && nvm alias default $NODE_VERSION \ + && nvm use default + + export NODE_PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin + export PATH=$PATH:$NODE_PATH + + pushd /var/www/html + echo "\n* Build assets ..."; + runuser -g www-data -u www-data -- /usr/bin/make assets + + echo "\n* Wait for assets built..."; + runuser -g www-data -u www-data -- /usr/bin/make wait-assets + popd +else + echo "\n* Build of assets was disabled..."; +fi + +/tmp/docker_run.sh diff --git a/base/images/7.1-fpm/config_files/docker_run.sh b/base/images/7.1-fpm/config_files/docker_run.sh index 6558a8a5..071b35ac 100755 --- a/base/images/7.1-fpm/config_files/docker_run.sh +++ b/base/images/7.1-fpm/config_files/docker_run.sh @@ -89,7 +89,7 @@ if [ ! -f ./config/settings.inc.php ] && [ ! -f ./install.lock ]; then runuser -g www-data -u www-data -- php -d memory_limit=-1 /var/www/html/$PS_FOLDER_INSTALL/index_cli.php \ --domain="$PS_DOMAIN" --db_server=$DB_SERVER:$DB_PORT --db_name="$DB_NAME" --db_user=$DB_USER \ --db_password=$DB_PASSWD --prefix="$DB_PREFIX" --firstname="John" --lastname="Doe" \ - --password=$ADMIN_PASSWD --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ + --password="$ADMIN_PASSWD" --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ --all_languages=$PS_ALL_LANGUAGES --newsletter=0 --send_email=0 --ssl=$PS_ENABLE_SSL if [ $? -ne 0 ]; then diff --git a/base/images/7.2-apache/Dockerfile b/base/images/7.2-apache/Dockerfile index dc141315..0abd4720 100644 --- a/base/images/7.2-apache/Dockerfile +++ b/base/images/7.2-apache/Dockerfile @@ -51,7 +51,7 @@ RUN docker-php-source extract \ && docker-php-source delete # Prepare install and CMD script -COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh /tmp/ +COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh config_files/docker_branch_run.sh /tmp/ # If handle dynamic domain COPY config_files/docker_updt_ps_domains.php /tmp/ diff --git a/base/images/7.2-apache/config_files/docker_branch_run.sh b/base/images/7.2-apache/config_files/docker_branch_run.sh new file mode 100755 index 00000000..7a24ceb8 --- /dev/null +++ b/base/images/7.2-apache/config_files/docker_branch_run.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +# Clone repository +if [ ! -f /var/www/html/composer.json ]; then + echo Clone PrestaShop $PS_BRANCH + git clone -b $PS_BRANCH https://github.com/PrestaShop/PrestaShop.git /var/www/html + chown -R www-data:www-data /var/www/html +fi + +# Install composer +if [ ! -f /usr/local/bin/composer ]; then + echo "\n* Install composer ..."; + mkdir -p /var/www/.composer + chown -R www-data:www-data /var/www/.composer + runuser -g www-data -u www-data -- php -r "copy('https://getcomposer.org/installer', '/tmp/composer-setup.php');" && php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer && rm -rf /tmp/composer-setup.php + if [ ! -f /usr/local/bin/composer ]; then + echo Composer installation failed + exit 1 + fi +fi + +# Install vendor dependencies +if [ ! -f /var/www/html/vendor/autoload.php ]; then + echo "\n* Running composer ..."; + pushd /var/www/html + # Execute composer as default user so that we can set the env variables to increase timeout, also disable default_socket_timeout for php + COMPOSER_PROCESS_TIMEOUT=600 COMPOSER_IPRESOLVE=4 php -ddefault_socket_timeout=-1 /usr/local/bin/composer install --ansi --prefer-dist --no-interaction --no-progress + # Update the owner of composer installed folders to be www-data + chown -R www-data:www-data vendor modules themes + popd +fi + +# Build assets +if [ "${DISABLE_MAKE}" != "1" ]; then + mkdir -p /var/www/.npm + chown -R www-data:www-data /var/www/.npm + + echo "\n* Install node $NODE_VERSION..."; + export NVM_DIR=/usr/local/nvm + mkdir -p $NVM_DIR \ + && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash \ + && . $NVM_DIR/nvm.sh \ + && nvm install $NODE_VERSION \ + && nvm alias default $NODE_VERSION \ + && nvm use default + + export NODE_PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin + export PATH=$PATH:$NODE_PATH + + pushd /var/www/html + echo "\n* Build assets ..."; + runuser -g www-data -u www-data -- /usr/bin/make assets + + echo "\n* Wait for assets built..."; + runuser -g www-data -u www-data -- /usr/bin/make wait-assets + popd +else + echo "\n* Build of assets was disabled..."; +fi + +/tmp/docker_run.sh diff --git a/base/images/7.2-apache/config_files/docker_run.sh b/base/images/7.2-apache/config_files/docker_run.sh index ea4faa82..5256a5a7 100755 --- a/base/images/7.2-apache/config_files/docker_run.sh +++ b/base/images/7.2-apache/config_files/docker_run.sh @@ -89,7 +89,7 @@ if [ ! -f ./config/settings.inc.php ] && [ ! -f ./install.lock ]; then runuser -g www-data -u www-data -- php -d memory_limit=-1 /var/www/html/$PS_FOLDER_INSTALL/index_cli.php \ --domain="$PS_DOMAIN" --db_server=$DB_SERVER:$DB_PORT --db_name="$DB_NAME" --db_user=$DB_USER \ --db_password=$DB_PASSWD --prefix="$DB_PREFIX" --firstname="John" --lastname="Doe" \ - --password=$ADMIN_PASSWD --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ + --password="$ADMIN_PASSWD" --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ --all_languages=$PS_ALL_LANGUAGES --newsletter=0 --send_email=0 --ssl=$PS_ENABLE_SSL if [ $? -ne 0 ]; then diff --git a/base/images/7.2-fpm/Dockerfile b/base/images/7.2-fpm/Dockerfile index 89192d33..6198df1f 100644 --- a/base/images/7.2-fpm/Dockerfile +++ b/base/images/7.2-fpm/Dockerfile @@ -51,7 +51,7 @@ RUN docker-php-source extract \ && docker-php-source delete # Prepare install and CMD script -COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh /tmp/ +COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh config_files/docker_branch_run.sh /tmp/ # If handle dynamic domain COPY config_files/docker_updt_ps_domains.php /tmp/ diff --git a/base/images/7.2-fpm/config_files/docker_branch_run.sh b/base/images/7.2-fpm/config_files/docker_branch_run.sh new file mode 100755 index 00000000..7a24ceb8 --- /dev/null +++ b/base/images/7.2-fpm/config_files/docker_branch_run.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +# Clone repository +if [ ! -f /var/www/html/composer.json ]; then + echo Clone PrestaShop $PS_BRANCH + git clone -b $PS_BRANCH https://github.com/PrestaShop/PrestaShop.git /var/www/html + chown -R www-data:www-data /var/www/html +fi + +# Install composer +if [ ! -f /usr/local/bin/composer ]; then + echo "\n* Install composer ..."; + mkdir -p /var/www/.composer + chown -R www-data:www-data /var/www/.composer + runuser -g www-data -u www-data -- php -r "copy('https://getcomposer.org/installer', '/tmp/composer-setup.php');" && php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer && rm -rf /tmp/composer-setup.php + if [ ! -f /usr/local/bin/composer ]; then + echo Composer installation failed + exit 1 + fi +fi + +# Install vendor dependencies +if [ ! -f /var/www/html/vendor/autoload.php ]; then + echo "\n* Running composer ..."; + pushd /var/www/html + # Execute composer as default user so that we can set the env variables to increase timeout, also disable default_socket_timeout for php + COMPOSER_PROCESS_TIMEOUT=600 COMPOSER_IPRESOLVE=4 php -ddefault_socket_timeout=-1 /usr/local/bin/composer install --ansi --prefer-dist --no-interaction --no-progress + # Update the owner of composer installed folders to be www-data + chown -R www-data:www-data vendor modules themes + popd +fi + +# Build assets +if [ "${DISABLE_MAKE}" != "1" ]; then + mkdir -p /var/www/.npm + chown -R www-data:www-data /var/www/.npm + + echo "\n* Install node $NODE_VERSION..."; + export NVM_DIR=/usr/local/nvm + mkdir -p $NVM_DIR \ + && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash \ + && . $NVM_DIR/nvm.sh \ + && nvm install $NODE_VERSION \ + && nvm alias default $NODE_VERSION \ + && nvm use default + + export NODE_PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin + export PATH=$PATH:$NODE_PATH + + pushd /var/www/html + echo "\n* Build assets ..."; + runuser -g www-data -u www-data -- /usr/bin/make assets + + echo "\n* Wait for assets built..."; + runuser -g www-data -u www-data -- /usr/bin/make wait-assets + popd +else + echo "\n* Build of assets was disabled..."; +fi + +/tmp/docker_run.sh diff --git a/base/images/7.2-fpm/config_files/docker_run.sh b/base/images/7.2-fpm/config_files/docker_run.sh index 6558a8a5..071b35ac 100755 --- a/base/images/7.2-fpm/config_files/docker_run.sh +++ b/base/images/7.2-fpm/config_files/docker_run.sh @@ -89,7 +89,7 @@ if [ ! -f ./config/settings.inc.php ] && [ ! -f ./install.lock ]; then runuser -g www-data -u www-data -- php -d memory_limit=-1 /var/www/html/$PS_FOLDER_INSTALL/index_cli.php \ --domain="$PS_DOMAIN" --db_server=$DB_SERVER:$DB_PORT --db_name="$DB_NAME" --db_user=$DB_USER \ --db_password=$DB_PASSWD --prefix="$DB_PREFIX" --firstname="John" --lastname="Doe" \ - --password=$ADMIN_PASSWD --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ + --password="$ADMIN_PASSWD" --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ --all_languages=$PS_ALL_LANGUAGES --newsletter=0 --send_email=0 --ssl=$PS_ENABLE_SSL if [ $? -ne 0 ]; then diff --git a/base/images/7.3-apache/Dockerfile b/base/images/7.3-apache/Dockerfile index 7dd9c10d..f4431101 100644 --- a/base/images/7.3-apache/Dockerfile +++ b/base/images/7.3-apache/Dockerfile @@ -51,7 +51,7 @@ RUN docker-php-source extract \ && docker-php-source delete # Prepare install and CMD script -COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh /tmp/ +COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh config_files/docker_branch_run.sh /tmp/ # If handle dynamic domain COPY config_files/docker_updt_ps_domains.php /tmp/ diff --git a/base/images/7.3-apache/config_files/docker_branch_run.sh b/base/images/7.3-apache/config_files/docker_branch_run.sh new file mode 100755 index 00000000..7a24ceb8 --- /dev/null +++ b/base/images/7.3-apache/config_files/docker_branch_run.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +# Clone repository +if [ ! -f /var/www/html/composer.json ]; then + echo Clone PrestaShop $PS_BRANCH + git clone -b $PS_BRANCH https://github.com/PrestaShop/PrestaShop.git /var/www/html + chown -R www-data:www-data /var/www/html +fi + +# Install composer +if [ ! -f /usr/local/bin/composer ]; then + echo "\n* Install composer ..."; + mkdir -p /var/www/.composer + chown -R www-data:www-data /var/www/.composer + runuser -g www-data -u www-data -- php -r "copy('https://getcomposer.org/installer', '/tmp/composer-setup.php');" && php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer && rm -rf /tmp/composer-setup.php + if [ ! -f /usr/local/bin/composer ]; then + echo Composer installation failed + exit 1 + fi +fi + +# Install vendor dependencies +if [ ! -f /var/www/html/vendor/autoload.php ]; then + echo "\n* Running composer ..."; + pushd /var/www/html + # Execute composer as default user so that we can set the env variables to increase timeout, also disable default_socket_timeout for php + COMPOSER_PROCESS_TIMEOUT=600 COMPOSER_IPRESOLVE=4 php -ddefault_socket_timeout=-1 /usr/local/bin/composer install --ansi --prefer-dist --no-interaction --no-progress + # Update the owner of composer installed folders to be www-data + chown -R www-data:www-data vendor modules themes + popd +fi + +# Build assets +if [ "${DISABLE_MAKE}" != "1" ]; then + mkdir -p /var/www/.npm + chown -R www-data:www-data /var/www/.npm + + echo "\n* Install node $NODE_VERSION..."; + export NVM_DIR=/usr/local/nvm + mkdir -p $NVM_DIR \ + && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash \ + && . $NVM_DIR/nvm.sh \ + && nvm install $NODE_VERSION \ + && nvm alias default $NODE_VERSION \ + && nvm use default + + export NODE_PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin + export PATH=$PATH:$NODE_PATH + + pushd /var/www/html + echo "\n* Build assets ..."; + runuser -g www-data -u www-data -- /usr/bin/make assets + + echo "\n* Wait for assets built..."; + runuser -g www-data -u www-data -- /usr/bin/make wait-assets + popd +else + echo "\n* Build of assets was disabled..."; +fi + +/tmp/docker_run.sh diff --git a/base/images/7.3-apache/config_files/docker_run.sh b/base/images/7.3-apache/config_files/docker_run.sh index ea4faa82..5256a5a7 100755 --- a/base/images/7.3-apache/config_files/docker_run.sh +++ b/base/images/7.3-apache/config_files/docker_run.sh @@ -89,7 +89,7 @@ if [ ! -f ./config/settings.inc.php ] && [ ! -f ./install.lock ]; then runuser -g www-data -u www-data -- php -d memory_limit=-1 /var/www/html/$PS_FOLDER_INSTALL/index_cli.php \ --domain="$PS_DOMAIN" --db_server=$DB_SERVER:$DB_PORT --db_name="$DB_NAME" --db_user=$DB_USER \ --db_password=$DB_PASSWD --prefix="$DB_PREFIX" --firstname="John" --lastname="Doe" \ - --password=$ADMIN_PASSWD --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ + --password="$ADMIN_PASSWD" --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ --all_languages=$PS_ALL_LANGUAGES --newsletter=0 --send_email=0 --ssl=$PS_ENABLE_SSL if [ $? -ne 0 ]; then diff --git a/base/images/7.3-fpm/Dockerfile b/base/images/7.3-fpm/Dockerfile index b643e2a8..51e5bede 100644 --- a/base/images/7.3-fpm/Dockerfile +++ b/base/images/7.3-fpm/Dockerfile @@ -40,7 +40,6 @@ RUN apt-get update \ libonig-dev RUN rm -rf /var/lib/apt/lists/* - # PHP < 7.4 have an old syntax to install GD. See https://github.com/docker-library/php/issues/912 RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-webp-dir=/usr/include RUN docker-php-ext-install iconv intl pdo_mysql mbstring soap gd zip bcmath @@ -52,7 +51,7 @@ RUN docker-php-source extract \ && docker-php-source delete # Prepare install and CMD script -COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh /tmp/ +COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh config_files/docker_branch_run.sh /tmp/ # If handle dynamic domain COPY config_files/docker_updt_ps_domains.php /tmp/ diff --git a/base/images/7.3-fpm/config_files/docker_branch_run.sh b/base/images/7.3-fpm/config_files/docker_branch_run.sh new file mode 100755 index 00000000..7a24ceb8 --- /dev/null +++ b/base/images/7.3-fpm/config_files/docker_branch_run.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +# Clone repository +if [ ! -f /var/www/html/composer.json ]; then + echo Clone PrestaShop $PS_BRANCH + git clone -b $PS_BRANCH https://github.com/PrestaShop/PrestaShop.git /var/www/html + chown -R www-data:www-data /var/www/html +fi + +# Install composer +if [ ! -f /usr/local/bin/composer ]; then + echo "\n* Install composer ..."; + mkdir -p /var/www/.composer + chown -R www-data:www-data /var/www/.composer + runuser -g www-data -u www-data -- php -r "copy('https://getcomposer.org/installer', '/tmp/composer-setup.php');" && php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer && rm -rf /tmp/composer-setup.php + if [ ! -f /usr/local/bin/composer ]; then + echo Composer installation failed + exit 1 + fi +fi + +# Install vendor dependencies +if [ ! -f /var/www/html/vendor/autoload.php ]; then + echo "\n* Running composer ..."; + pushd /var/www/html + # Execute composer as default user so that we can set the env variables to increase timeout, also disable default_socket_timeout for php + COMPOSER_PROCESS_TIMEOUT=600 COMPOSER_IPRESOLVE=4 php -ddefault_socket_timeout=-1 /usr/local/bin/composer install --ansi --prefer-dist --no-interaction --no-progress + # Update the owner of composer installed folders to be www-data + chown -R www-data:www-data vendor modules themes + popd +fi + +# Build assets +if [ "${DISABLE_MAKE}" != "1" ]; then + mkdir -p /var/www/.npm + chown -R www-data:www-data /var/www/.npm + + echo "\n* Install node $NODE_VERSION..."; + export NVM_DIR=/usr/local/nvm + mkdir -p $NVM_DIR \ + && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash \ + && . $NVM_DIR/nvm.sh \ + && nvm install $NODE_VERSION \ + && nvm alias default $NODE_VERSION \ + && nvm use default + + export NODE_PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin + export PATH=$PATH:$NODE_PATH + + pushd /var/www/html + echo "\n* Build assets ..."; + runuser -g www-data -u www-data -- /usr/bin/make assets + + echo "\n* Wait for assets built..."; + runuser -g www-data -u www-data -- /usr/bin/make wait-assets + popd +else + echo "\n* Build of assets was disabled..."; +fi + +/tmp/docker_run.sh diff --git a/base/images/7.3-fpm/config_files/docker_run.sh b/base/images/7.3-fpm/config_files/docker_run.sh index 6558a8a5..071b35ac 100755 --- a/base/images/7.3-fpm/config_files/docker_run.sh +++ b/base/images/7.3-fpm/config_files/docker_run.sh @@ -89,7 +89,7 @@ if [ ! -f ./config/settings.inc.php ] && [ ! -f ./install.lock ]; then runuser -g www-data -u www-data -- php -d memory_limit=-1 /var/www/html/$PS_FOLDER_INSTALL/index_cli.php \ --domain="$PS_DOMAIN" --db_server=$DB_SERVER:$DB_PORT --db_name="$DB_NAME" --db_user=$DB_USER \ --db_password=$DB_PASSWD --prefix="$DB_PREFIX" --firstname="John" --lastname="Doe" \ - --password=$ADMIN_PASSWD --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ + --password="$ADMIN_PASSWD" --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ --all_languages=$PS_ALL_LANGUAGES --newsletter=0 --send_email=0 --ssl=$PS_ENABLE_SSL if [ $? -ne 0 ]; then diff --git a/base/images/7.4-apache/Dockerfile b/base/images/7.4-apache/Dockerfile index c45609db..8c6e4024 100644 --- a/base/images/7.4-apache/Dockerfile +++ b/base/images/7.4-apache/Dockerfile @@ -40,7 +40,8 @@ RUN apt-get update \ libonig-dev RUN rm -rf /var/lib/apt/lists/* -RUN docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ --with-webp=/usr/include +# PHP < 7.4 have an old syntax to install GD. See https://github.com/docker-library/php/issues/912 +RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-webp-dir=/usr/include RUN docker-php-ext-install iconv intl pdo_mysql mbstring soap gd zip bcmath RUN docker-php-source extract \ @@ -50,7 +51,7 @@ RUN docker-php-source extract \ && docker-php-source delete # Prepare install and CMD script -COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh /tmp/ +COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh config_files/docker_branch_run.sh /tmp/ # If handle dynamic domain COPY config_files/docker_updt_ps_domains.php /tmp/ diff --git a/base/images/7.4-apache/config_files/docker_branch_run.sh b/base/images/7.4-apache/config_files/docker_branch_run.sh new file mode 100755 index 00000000..7a24ceb8 --- /dev/null +++ b/base/images/7.4-apache/config_files/docker_branch_run.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +# Clone repository +if [ ! -f /var/www/html/composer.json ]; then + echo Clone PrestaShop $PS_BRANCH + git clone -b $PS_BRANCH https://github.com/PrestaShop/PrestaShop.git /var/www/html + chown -R www-data:www-data /var/www/html +fi + +# Install composer +if [ ! -f /usr/local/bin/composer ]; then + echo "\n* Install composer ..."; + mkdir -p /var/www/.composer + chown -R www-data:www-data /var/www/.composer + runuser -g www-data -u www-data -- php -r "copy('https://getcomposer.org/installer', '/tmp/composer-setup.php');" && php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer && rm -rf /tmp/composer-setup.php + if [ ! -f /usr/local/bin/composer ]; then + echo Composer installation failed + exit 1 + fi +fi + +# Install vendor dependencies +if [ ! -f /var/www/html/vendor/autoload.php ]; then + echo "\n* Running composer ..."; + pushd /var/www/html + # Execute composer as default user so that we can set the env variables to increase timeout, also disable default_socket_timeout for php + COMPOSER_PROCESS_TIMEOUT=600 COMPOSER_IPRESOLVE=4 php -ddefault_socket_timeout=-1 /usr/local/bin/composer install --ansi --prefer-dist --no-interaction --no-progress + # Update the owner of composer installed folders to be www-data + chown -R www-data:www-data vendor modules themes + popd +fi + +# Build assets +if [ "${DISABLE_MAKE}" != "1" ]; then + mkdir -p /var/www/.npm + chown -R www-data:www-data /var/www/.npm + + echo "\n* Install node $NODE_VERSION..."; + export NVM_DIR=/usr/local/nvm + mkdir -p $NVM_DIR \ + && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash \ + && . $NVM_DIR/nvm.sh \ + && nvm install $NODE_VERSION \ + && nvm alias default $NODE_VERSION \ + && nvm use default + + export NODE_PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin + export PATH=$PATH:$NODE_PATH + + pushd /var/www/html + echo "\n* Build assets ..."; + runuser -g www-data -u www-data -- /usr/bin/make assets + + echo "\n* Wait for assets built..."; + runuser -g www-data -u www-data -- /usr/bin/make wait-assets + popd +else + echo "\n* Build of assets was disabled..."; +fi + +/tmp/docker_run.sh diff --git a/base/images/7.4-apache/config_files/docker_run.sh b/base/images/7.4-apache/config_files/docker_run.sh index ea4faa82..5256a5a7 100755 --- a/base/images/7.4-apache/config_files/docker_run.sh +++ b/base/images/7.4-apache/config_files/docker_run.sh @@ -89,7 +89,7 @@ if [ ! -f ./config/settings.inc.php ] && [ ! -f ./install.lock ]; then runuser -g www-data -u www-data -- php -d memory_limit=-1 /var/www/html/$PS_FOLDER_INSTALL/index_cli.php \ --domain="$PS_DOMAIN" --db_server=$DB_SERVER:$DB_PORT --db_name="$DB_NAME" --db_user=$DB_USER \ --db_password=$DB_PASSWD --prefix="$DB_PREFIX" --firstname="John" --lastname="Doe" \ - --password=$ADMIN_PASSWD --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ + --password="$ADMIN_PASSWD" --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ --all_languages=$PS_ALL_LANGUAGES --newsletter=0 --send_email=0 --ssl=$PS_ENABLE_SSL if [ $? -ne 0 ]; then diff --git a/base/images/7.4-fpm/Dockerfile b/base/images/7.4-fpm/Dockerfile index ff9e156d..7ea5a04e 100644 --- a/base/images/7.4-fpm/Dockerfile +++ b/base/images/7.4-fpm/Dockerfile @@ -40,7 +40,8 @@ RUN apt-get update \ libonig-dev RUN rm -rf /var/lib/apt/lists/* -RUN docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ --with-webp=/usr/include +# PHP < 7.4 have an old syntax to install GD. See https://github.com/docker-library/php/issues/912 +RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-webp-dir=/usr/include RUN docker-php-ext-install iconv intl pdo_mysql mbstring soap gd zip bcmath RUN docker-php-source extract \ @@ -50,7 +51,7 @@ RUN docker-php-source extract \ && docker-php-source delete # Prepare install and CMD script -COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh /tmp/ +COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh config_files/docker_branch_run.sh /tmp/ # If handle dynamic domain COPY config_files/docker_updt_ps_domains.php /tmp/ diff --git a/base/images/7.4-fpm/config_files/docker_branch_run.sh b/base/images/7.4-fpm/config_files/docker_branch_run.sh new file mode 100755 index 00000000..7a24ceb8 --- /dev/null +++ b/base/images/7.4-fpm/config_files/docker_branch_run.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +# Clone repository +if [ ! -f /var/www/html/composer.json ]; then + echo Clone PrestaShop $PS_BRANCH + git clone -b $PS_BRANCH https://github.com/PrestaShop/PrestaShop.git /var/www/html + chown -R www-data:www-data /var/www/html +fi + +# Install composer +if [ ! -f /usr/local/bin/composer ]; then + echo "\n* Install composer ..."; + mkdir -p /var/www/.composer + chown -R www-data:www-data /var/www/.composer + runuser -g www-data -u www-data -- php -r "copy('https://getcomposer.org/installer', '/tmp/composer-setup.php');" && php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer && rm -rf /tmp/composer-setup.php + if [ ! -f /usr/local/bin/composer ]; then + echo Composer installation failed + exit 1 + fi +fi + +# Install vendor dependencies +if [ ! -f /var/www/html/vendor/autoload.php ]; then + echo "\n* Running composer ..."; + pushd /var/www/html + # Execute composer as default user so that we can set the env variables to increase timeout, also disable default_socket_timeout for php + COMPOSER_PROCESS_TIMEOUT=600 COMPOSER_IPRESOLVE=4 php -ddefault_socket_timeout=-1 /usr/local/bin/composer install --ansi --prefer-dist --no-interaction --no-progress + # Update the owner of composer installed folders to be www-data + chown -R www-data:www-data vendor modules themes + popd +fi + +# Build assets +if [ "${DISABLE_MAKE}" != "1" ]; then + mkdir -p /var/www/.npm + chown -R www-data:www-data /var/www/.npm + + echo "\n* Install node $NODE_VERSION..."; + export NVM_DIR=/usr/local/nvm + mkdir -p $NVM_DIR \ + && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash \ + && . $NVM_DIR/nvm.sh \ + && nvm install $NODE_VERSION \ + && nvm alias default $NODE_VERSION \ + && nvm use default + + export NODE_PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin + export PATH=$PATH:$NODE_PATH + + pushd /var/www/html + echo "\n* Build assets ..."; + runuser -g www-data -u www-data -- /usr/bin/make assets + + echo "\n* Wait for assets built..."; + runuser -g www-data -u www-data -- /usr/bin/make wait-assets + popd +else + echo "\n* Build of assets was disabled..."; +fi + +/tmp/docker_run.sh diff --git a/base/images/7.4-fpm/config_files/docker_run.sh b/base/images/7.4-fpm/config_files/docker_run.sh index 6558a8a5..071b35ac 100755 --- a/base/images/7.4-fpm/config_files/docker_run.sh +++ b/base/images/7.4-fpm/config_files/docker_run.sh @@ -89,7 +89,7 @@ if [ ! -f ./config/settings.inc.php ] && [ ! -f ./install.lock ]; then runuser -g www-data -u www-data -- php -d memory_limit=-1 /var/www/html/$PS_FOLDER_INSTALL/index_cli.php \ --domain="$PS_DOMAIN" --db_server=$DB_SERVER:$DB_PORT --db_name="$DB_NAME" --db_user=$DB_USER \ --db_password=$DB_PASSWD --prefix="$DB_PREFIX" --firstname="John" --lastname="Doe" \ - --password=$ADMIN_PASSWD --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ + --password="$ADMIN_PASSWD" --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ --all_languages=$PS_ALL_LANGUAGES --newsletter=0 --send_email=0 --ssl=$PS_ENABLE_SSL if [ $? -ne 0 ]; then diff --git a/base/images/8.0-apache/Dockerfile b/base/images/8.0-apache/Dockerfile index da958f9f..3077e2e0 100644 --- a/base/images/8.0-apache/Dockerfile +++ b/base/images/8.0-apache/Dockerfile @@ -50,7 +50,7 @@ RUN docker-php-source extract \ && docker-php-source delete # Prepare install and CMD script -COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh /tmp/ +COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh config_files/docker_branch_run.sh /tmp/ # If handle dynamic domain COPY config_files/docker_updt_ps_domains.php /tmp/ diff --git a/base/images/8.0-apache/config_files/docker_branch_run.sh b/base/images/8.0-apache/config_files/docker_branch_run.sh new file mode 100755 index 00000000..7a24ceb8 --- /dev/null +++ b/base/images/8.0-apache/config_files/docker_branch_run.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +# Clone repository +if [ ! -f /var/www/html/composer.json ]; then + echo Clone PrestaShop $PS_BRANCH + git clone -b $PS_BRANCH https://github.com/PrestaShop/PrestaShop.git /var/www/html + chown -R www-data:www-data /var/www/html +fi + +# Install composer +if [ ! -f /usr/local/bin/composer ]; then + echo "\n* Install composer ..."; + mkdir -p /var/www/.composer + chown -R www-data:www-data /var/www/.composer + runuser -g www-data -u www-data -- php -r "copy('https://getcomposer.org/installer', '/tmp/composer-setup.php');" && php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer && rm -rf /tmp/composer-setup.php + if [ ! -f /usr/local/bin/composer ]; then + echo Composer installation failed + exit 1 + fi +fi + +# Install vendor dependencies +if [ ! -f /var/www/html/vendor/autoload.php ]; then + echo "\n* Running composer ..."; + pushd /var/www/html + # Execute composer as default user so that we can set the env variables to increase timeout, also disable default_socket_timeout for php + COMPOSER_PROCESS_TIMEOUT=600 COMPOSER_IPRESOLVE=4 php -ddefault_socket_timeout=-1 /usr/local/bin/composer install --ansi --prefer-dist --no-interaction --no-progress + # Update the owner of composer installed folders to be www-data + chown -R www-data:www-data vendor modules themes + popd +fi + +# Build assets +if [ "${DISABLE_MAKE}" != "1" ]; then + mkdir -p /var/www/.npm + chown -R www-data:www-data /var/www/.npm + + echo "\n* Install node $NODE_VERSION..."; + export NVM_DIR=/usr/local/nvm + mkdir -p $NVM_DIR \ + && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash \ + && . $NVM_DIR/nvm.sh \ + && nvm install $NODE_VERSION \ + && nvm alias default $NODE_VERSION \ + && nvm use default + + export NODE_PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin + export PATH=$PATH:$NODE_PATH + + pushd /var/www/html + echo "\n* Build assets ..."; + runuser -g www-data -u www-data -- /usr/bin/make assets + + echo "\n* Wait for assets built..."; + runuser -g www-data -u www-data -- /usr/bin/make wait-assets + popd +else + echo "\n* Build of assets was disabled..."; +fi + +/tmp/docker_run.sh diff --git a/base/images/8.0-apache/config_files/docker_run.sh b/base/images/8.0-apache/config_files/docker_run.sh index ea4faa82..5256a5a7 100755 --- a/base/images/8.0-apache/config_files/docker_run.sh +++ b/base/images/8.0-apache/config_files/docker_run.sh @@ -89,7 +89,7 @@ if [ ! -f ./config/settings.inc.php ] && [ ! -f ./install.lock ]; then runuser -g www-data -u www-data -- php -d memory_limit=-1 /var/www/html/$PS_FOLDER_INSTALL/index_cli.php \ --domain="$PS_DOMAIN" --db_server=$DB_SERVER:$DB_PORT --db_name="$DB_NAME" --db_user=$DB_USER \ --db_password=$DB_PASSWD --prefix="$DB_PREFIX" --firstname="John" --lastname="Doe" \ - --password=$ADMIN_PASSWD --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ + --password="$ADMIN_PASSWD" --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ --all_languages=$PS_ALL_LANGUAGES --newsletter=0 --send_email=0 --ssl=$PS_ENABLE_SSL if [ $? -ne 0 ]; then diff --git a/base/images/8.0-fpm/Dockerfile b/base/images/8.0-fpm/Dockerfile index b317858e..549daed2 100644 --- a/base/images/8.0-fpm/Dockerfile +++ b/base/images/8.0-fpm/Dockerfile @@ -50,7 +50,7 @@ RUN docker-php-source extract \ && docker-php-source delete # Prepare install and CMD script -COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh /tmp/ +COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh config_files/docker_branch_run.sh /tmp/ # If handle dynamic domain COPY config_files/docker_updt_ps_domains.php /tmp/ diff --git a/base/images/8.0-fpm/config_files/docker_branch_run.sh b/base/images/8.0-fpm/config_files/docker_branch_run.sh new file mode 100755 index 00000000..7a24ceb8 --- /dev/null +++ b/base/images/8.0-fpm/config_files/docker_branch_run.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +# Clone repository +if [ ! -f /var/www/html/composer.json ]; then + echo Clone PrestaShop $PS_BRANCH + git clone -b $PS_BRANCH https://github.com/PrestaShop/PrestaShop.git /var/www/html + chown -R www-data:www-data /var/www/html +fi + +# Install composer +if [ ! -f /usr/local/bin/composer ]; then + echo "\n* Install composer ..."; + mkdir -p /var/www/.composer + chown -R www-data:www-data /var/www/.composer + runuser -g www-data -u www-data -- php -r "copy('https://getcomposer.org/installer', '/tmp/composer-setup.php');" && php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer && rm -rf /tmp/composer-setup.php + if [ ! -f /usr/local/bin/composer ]; then + echo Composer installation failed + exit 1 + fi +fi + +# Install vendor dependencies +if [ ! -f /var/www/html/vendor/autoload.php ]; then + echo "\n* Running composer ..."; + pushd /var/www/html + # Execute composer as default user so that we can set the env variables to increase timeout, also disable default_socket_timeout for php + COMPOSER_PROCESS_TIMEOUT=600 COMPOSER_IPRESOLVE=4 php -ddefault_socket_timeout=-1 /usr/local/bin/composer install --ansi --prefer-dist --no-interaction --no-progress + # Update the owner of composer installed folders to be www-data + chown -R www-data:www-data vendor modules themes + popd +fi + +# Build assets +if [ "${DISABLE_MAKE}" != "1" ]; then + mkdir -p /var/www/.npm + chown -R www-data:www-data /var/www/.npm + + echo "\n* Install node $NODE_VERSION..."; + export NVM_DIR=/usr/local/nvm + mkdir -p $NVM_DIR \ + && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash \ + && . $NVM_DIR/nvm.sh \ + && nvm install $NODE_VERSION \ + && nvm alias default $NODE_VERSION \ + && nvm use default + + export NODE_PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin + export PATH=$PATH:$NODE_PATH + + pushd /var/www/html + echo "\n* Build assets ..."; + runuser -g www-data -u www-data -- /usr/bin/make assets + + echo "\n* Wait for assets built..."; + runuser -g www-data -u www-data -- /usr/bin/make wait-assets + popd +else + echo "\n* Build of assets was disabled..."; +fi + +/tmp/docker_run.sh diff --git a/base/images/8.0-fpm/config_files/docker_run.sh b/base/images/8.0-fpm/config_files/docker_run.sh index 6558a8a5..071b35ac 100755 --- a/base/images/8.0-fpm/config_files/docker_run.sh +++ b/base/images/8.0-fpm/config_files/docker_run.sh @@ -89,7 +89,7 @@ if [ ! -f ./config/settings.inc.php ] && [ ! -f ./install.lock ]; then runuser -g www-data -u www-data -- php -d memory_limit=-1 /var/www/html/$PS_FOLDER_INSTALL/index_cli.php \ --domain="$PS_DOMAIN" --db_server=$DB_SERVER:$DB_PORT --db_name="$DB_NAME" --db_user=$DB_USER \ --db_password=$DB_PASSWD --prefix="$DB_PREFIX" --firstname="John" --lastname="Doe" \ - --password=$ADMIN_PASSWD --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ + --password="$ADMIN_PASSWD" --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ --all_languages=$PS_ALL_LANGUAGES --newsletter=0 --send_email=0 --ssl=$PS_ENABLE_SSL if [ $? -ne 0 ]; then diff --git a/base/images/8.1-apache/Dockerfile b/base/images/8.1-apache/Dockerfile index b762d70c..92b2495e 100644 --- a/base/images/8.1-apache/Dockerfile +++ b/base/images/8.1-apache/Dockerfile @@ -50,7 +50,7 @@ RUN docker-php-source extract \ && docker-php-source delete # Prepare install and CMD script -COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh /tmp/ +COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh config_files/docker_branch_run.sh /tmp/ # If handle dynamic domain COPY config_files/docker_updt_ps_domains.php /tmp/ diff --git a/base/images/8.1-apache/config_files/docker_branch_run.sh b/base/images/8.1-apache/config_files/docker_branch_run.sh new file mode 100755 index 00000000..7a24ceb8 --- /dev/null +++ b/base/images/8.1-apache/config_files/docker_branch_run.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +# Clone repository +if [ ! -f /var/www/html/composer.json ]; then + echo Clone PrestaShop $PS_BRANCH + git clone -b $PS_BRANCH https://github.com/PrestaShop/PrestaShop.git /var/www/html + chown -R www-data:www-data /var/www/html +fi + +# Install composer +if [ ! -f /usr/local/bin/composer ]; then + echo "\n* Install composer ..."; + mkdir -p /var/www/.composer + chown -R www-data:www-data /var/www/.composer + runuser -g www-data -u www-data -- php -r "copy('https://getcomposer.org/installer', '/tmp/composer-setup.php');" && php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer && rm -rf /tmp/composer-setup.php + if [ ! -f /usr/local/bin/composer ]; then + echo Composer installation failed + exit 1 + fi +fi + +# Install vendor dependencies +if [ ! -f /var/www/html/vendor/autoload.php ]; then + echo "\n* Running composer ..."; + pushd /var/www/html + # Execute composer as default user so that we can set the env variables to increase timeout, also disable default_socket_timeout for php + COMPOSER_PROCESS_TIMEOUT=600 COMPOSER_IPRESOLVE=4 php -ddefault_socket_timeout=-1 /usr/local/bin/composer install --ansi --prefer-dist --no-interaction --no-progress + # Update the owner of composer installed folders to be www-data + chown -R www-data:www-data vendor modules themes + popd +fi + +# Build assets +if [ "${DISABLE_MAKE}" != "1" ]; then + mkdir -p /var/www/.npm + chown -R www-data:www-data /var/www/.npm + + echo "\n* Install node $NODE_VERSION..."; + export NVM_DIR=/usr/local/nvm + mkdir -p $NVM_DIR \ + && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash \ + && . $NVM_DIR/nvm.sh \ + && nvm install $NODE_VERSION \ + && nvm alias default $NODE_VERSION \ + && nvm use default + + export NODE_PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin + export PATH=$PATH:$NODE_PATH + + pushd /var/www/html + echo "\n* Build assets ..."; + runuser -g www-data -u www-data -- /usr/bin/make assets + + echo "\n* Wait for assets built..."; + runuser -g www-data -u www-data -- /usr/bin/make wait-assets + popd +else + echo "\n* Build of assets was disabled..."; +fi + +/tmp/docker_run.sh diff --git a/base/images/8.1-apache/config_files/docker_run.sh b/base/images/8.1-apache/config_files/docker_run.sh index ea4faa82..5256a5a7 100755 --- a/base/images/8.1-apache/config_files/docker_run.sh +++ b/base/images/8.1-apache/config_files/docker_run.sh @@ -89,7 +89,7 @@ if [ ! -f ./config/settings.inc.php ] && [ ! -f ./install.lock ]; then runuser -g www-data -u www-data -- php -d memory_limit=-1 /var/www/html/$PS_FOLDER_INSTALL/index_cli.php \ --domain="$PS_DOMAIN" --db_server=$DB_SERVER:$DB_PORT --db_name="$DB_NAME" --db_user=$DB_USER \ --db_password=$DB_PASSWD --prefix="$DB_PREFIX" --firstname="John" --lastname="Doe" \ - --password=$ADMIN_PASSWD --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ + --password="$ADMIN_PASSWD" --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ --all_languages=$PS_ALL_LANGUAGES --newsletter=0 --send_email=0 --ssl=$PS_ENABLE_SSL if [ $? -ne 0 ]; then diff --git a/base/images/8.1-fpm/Dockerfile b/base/images/8.1-fpm/Dockerfile index 9863f518..0a67c3aa 100644 --- a/base/images/8.1-fpm/Dockerfile +++ b/base/images/8.1-fpm/Dockerfile @@ -50,7 +50,7 @@ RUN docker-php-source extract \ && docker-php-source delete # Prepare install and CMD script -COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh /tmp/ +COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh config_files/docker_branch_run.sh /tmp/ # If handle dynamic domain COPY config_files/docker_updt_ps_domains.php /tmp/ diff --git a/base/images/8.1-fpm/config_files/docker_branch_run.sh b/base/images/8.1-fpm/config_files/docker_branch_run.sh new file mode 100755 index 00000000..7a24ceb8 --- /dev/null +++ b/base/images/8.1-fpm/config_files/docker_branch_run.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +# Clone repository +if [ ! -f /var/www/html/composer.json ]; then + echo Clone PrestaShop $PS_BRANCH + git clone -b $PS_BRANCH https://github.com/PrestaShop/PrestaShop.git /var/www/html + chown -R www-data:www-data /var/www/html +fi + +# Install composer +if [ ! -f /usr/local/bin/composer ]; then + echo "\n* Install composer ..."; + mkdir -p /var/www/.composer + chown -R www-data:www-data /var/www/.composer + runuser -g www-data -u www-data -- php -r "copy('https://getcomposer.org/installer', '/tmp/composer-setup.php');" && php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer && rm -rf /tmp/composer-setup.php + if [ ! -f /usr/local/bin/composer ]; then + echo Composer installation failed + exit 1 + fi +fi + +# Install vendor dependencies +if [ ! -f /var/www/html/vendor/autoload.php ]; then + echo "\n* Running composer ..."; + pushd /var/www/html + # Execute composer as default user so that we can set the env variables to increase timeout, also disable default_socket_timeout for php + COMPOSER_PROCESS_TIMEOUT=600 COMPOSER_IPRESOLVE=4 php -ddefault_socket_timeout=-1 /usr/local/bin/composer install --ansi --prefer-dist --no-interaction --no-progress + # Update the owner of composer installed folders to be www-data + chown -R www-data:www-data vendor modules themes + popd +fi + +# Build assets +if [ "${DISABLE_MAKE}" != "1" ]; then + mkdir -p /var/www/.npm + chown -R www-data:www-data /var/www/.npm + + echo "\n* Install node $NODE_VERSION..."; + export NVM_DIR=/usr/local/nvm + mkdir -p $NVM_DIR \ + && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash \ + && . $NVM_DIR/nvm.sh \ + && nvm install $NODE_VERSION \ + && nvm alias default $NODE_VERSION \ + && nvm use default + + export NODE_PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin + export PATH=$PATH:$NODE_PATH + + pushd /var/www/html + echo "\n* Build assets ..."; + runuser -g www-data -u www-data -- /usr/bin/make assets + + echo "\n* Wait for assets built..."; + runuser -g www-data -u www-data -- /usr/bin/make wait-assets + popd +else + echo "\n* Build of assets was disabled..."; +fi + +/tmp/docker_run.sh diff --git a/base/images/8.1-fpm/config_files/docker_run.sh b/base/images/8.1-fpm/config_files/docker_run.sh index 6558a8a5..071b35ac 100755 --- a/base/images/8.1-fpm/config_files/docker_run.sh +++ b/base/images/8.1-fpm/config_files/docker_run.sh @@ -89,7 +89,7 @@ if [ ! -f ./config/settings.inc.php ] && [ ! -f ./install.lock ]; then runuser -g www-data -u www-data -- php -d memory_limit=-1 /var/www/html/$PS_FOLDER_INSTALL/index_cli.php \ --domain="$PS_DOMAIN" --db_server=$DB_SERVER:$DB_PORT --db_name="$DB_NAME" --db_user=$DB_USER \ --db_password=$DB_PASSWD --prefix="$DB_PREFIX" --firstname="John" --lastname="Doe" \ - --password=$ADMIN_PASSWD --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ + --password="$ADMIN_PASSWD" --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ --all_languages=$PS_ALL_LANGUAGES --newsletter=0 --send_email=0 --ssl=$PS_ENABLE_SSL if [ $? -ne 0 ]; then diff --git a/base/images/8.2-apache/Dockerfile b/base/images/8.2-apache/Dockerfile index 01726944..32271cb3 100644 --- a/base/images/8.2-apache/Dockerfile +++ b/base/images/8.2-apache/Dockerfile @@ -50,7 +50,7 @@ RUN docker-php-source extract \ && docker-php-source delete # Prepare install and CMD script -COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh /tmp/ +COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh config_files/docker_branch_run.sh /tmp/ # If handle dynamic domain COPY config_files/docker_updt_ps_domains.php /tmp/ diff --git a/base/images/8.2-apache/config_files/docker_branch_run.sh b/base/images/8.2-apache/config_files/docker_branch_run.sh new file mode 100755 index 00000000..7a24ceb8 --- /dev/null +++ b/base/images/8.2-apache/config_files/docker_branch_run.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +# Clone repository +if [ ! -f /var/www/html/composer.json ]; then + echo Clone PrestaShop $PS_BRANCH + git clone -b $PS_BRANCH https://github.com/PrestaShop/PrestaShop.git /var/www/html + chown -R www-data:www-data /var/www/html +fi + +# Install composer +if [ ! -f /usr/local/bin/composer ]; then + echo "\n* Install composer ..."; + mkdir -p /var/www/.composer + chown -R www-data:www-data /var/www/.composer + runuser -g www-data -u www-data -- php -r "copy('https://getcomposer.org/installer', '/tmp/composer-setup.php');" && php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer && rm -rf /tmp/composer-setup.php + if [ ! -f /usr/local/bin/composer ]; then + echo Composer installation failed + exit 1 + fi +fi + +# Install vendor dependencies +if [ ! -f /var/www/html/vendor/autoload.php ]; then + echo "\n* Running composer ..."; + pushd /var/www/html + # Execute composer as default user so that we can set the env variables to increase timeout, also disable default_socket_timeout for php + COMPOSER_PROCESS_TIMEOUT=600 COMPOSER_IPRESOLVE=4 php -ddefault_socket_timeout=-1 /usr/local/bin/composer install --ansi --prefer-dist --no-interaction --no-progress + # Update the owner of composer installed folders to be www-data + chown -R www-data:www-data vendor modules themes + popd +fi + +# Build assets +if [ "${DISABLE_MAKE}" != "1" ]; then + mkdir -p /var/www/.npm + chown -R www-data:www-data /var/www/.npm + + echo "\n* Install node $NODE_VERSION..."; + export NVM_DIR=/usr/local/nvm + mkdir -p $NVM_DIR \ + && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash \ + && . $NVM_DIR/nvm.sh \ + && nvm install $NODE_VERSION \ + && nvm alias default $NODE_VERSION \ + && nvm use default + + export NODE_PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin + export PATH=$PATH:$NODE_PATH + + pushd /var/www/html + echo "\n* Build assets ..."; + runuser -g www-data -u www-data -- /usr/bin/make assets + + echo "\n* Wait for assets built..."; + runuser -g www-data -u www-data -- /usr/bin/make wait-assets + popd +else + echo "\n* Build of assets was disabled..."; +fi + +/tmp/docker_run.sh diff --git a/base/images/8.2-apache/config_files/docker_run.sh b/base/images/8.2-apache/config_files/docker_run.sh index ea4faa82..5256a5a7 100755 --- a/base/images/8.2-apache/config_files/docker_run.sh +++ b/base/images/8.2-apache/config_files/docker_run.sh @@ -89,7 +89,7 @@ if [ ! -f ./config/settings.inc.php ] && [ ! -f ./install.lock ]; then runuser -g www-data -u www-data -- php -d memory_limit=-1 /var/www/html/$PS_FOLDER_INSTALL/index_cli.php \ --domain="$PS_DOMAIN" --db_server=$DB_SERVER:$DB_PORT --db_name="$DB_NAME" --db_user=$DB_USER \ --db_password=$DB_PASSWD --prefix="$DB_PREFIX" --firstname="John" --lastname="Doe" \ - --password=$ADMIN_PASSWD --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ + --password="$ADMIN_PASSWD" --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ --all_languages=$PS_ALL_LANGUAGES --newsletter=0 --send_email=0 --ssl=$PS_ENABLE_SSL if [ $? -ne 0 ]; then diff --git a/base/images/8.2-fpm/Dockerfile b/base/images/8.2-fpm/Dockerfile index d392d0d8..2343651e 100644 --- a/base/images/8.2-fpm/Dockerfile +++ b/base/images/8.2-fpm/Dockerfile @@ -50,7 +50,7 @@ RUN docker-php-source extract \ && docker-php-source delete # Prepare install and CMD script -COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh /tmp/ +COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh config_files/docker_branch_run.sh /tmp/ # If handle dynamic domain COPY config_files/docker_updt_ps_domains.php /tmp/ diff --git a/base/images/8.2-fpm/config_files/docker_branch_run.sh b/base/images/8.2-fpm/config_files/docker_branch_run.sh new file mode 100755 index 00000000..7a24ceb8 --- /dev/null +++ b/base/images/8.2-fpm/config_files/docker_branch_run.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +# Clone repository +if [ ! -f /var/www/html/composer.json ]; then + echo Clone PrestaShop $PS_BRANCH + git clone -b $PS_BRANCH https://github.com/PrestaShop/PrestaShop.git /var/www/html + chown -R www-data:www-data /var/www/html +fi + +# Install composer +if [ ! -f /usr/local/bin/composer ]; then + echo "\n* Install composer ..."; + mkdir -p /var/www/.composer + chown -R www-data:www-data /var/www/.composer + runuser -g www-data -u www-data -- php -r "copy('https://getcomposer.org/installer', '/tmp/composer-setup.php');" && php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer && rm -rf /tmp/composer-setup.php + if [ ! -f /usr/local/bin/composer ]; then + echo Composer installation failed + exit 1 + fi +fi + +# Install vendor dependencies +if [ ! -f /var/www/html/vendor/autoload.php ]; then + echo "\n* Running composer ..."; + pushd /var/www/html + # Execute composer as default user so that we can set the env variables to increase timeout, also disable default_socket_timeout for php + COMPOSER_PROCESS_TIMEOUT=600 COMPOSER_IPRESOLVE=4 php -ddefault_socket_timeout=-1 /usr/local/bin/composer install --ansi --prefer-dist --no-interaction --no-progress + # Update the owner of composer installed folders to be www-data + chown -R www-data:www-data vendor modules themes + popd +fi + +# Build assets +if [ "${DISABLE_MAKE}" != "1" ]; then + mkdir -p /var/www/.npm + chown -R www-data:www-data /var/www/.npm + + echo "\n* Install node $NODE_VERSION..."; + export NVM_DIR=/usr/local/nvm + mkdir -p $NVM_DIR \ + && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash \ + && . $NVM_DIR/nvm.sh \ + && nvm install $NODE_VERSION \ + && nvm alias default $NODE_VERSION \ + && nvm use default + + export NODE_PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin + export PATH=$PATH:$NODE_PATH + + pushd /var/www/html + echo "\n* Build assets ..."; + runuser -g www-data -u www-data -- /usr/bin/make assets + + echo "\n* Wait for assets built..."; + runuser -g www-data -u www-data -- /usr/bin/make wait-assets + popd +else + echo "\n* Build of assets was disabled..."; +fi + +/tmp/docker_run.sh diff --git a/base/images/8.2-fpm/config_files/docker_run.sh b/base/images/8.2-fpm/config_files/docker_run.sh index 6558a8a5..071b35ac 100755 --- a/base/images/8.2-fpm/config_files/docker_run.sh +++ b/base/images/8.2-fpm/config_files/docker_run.sh @@ -89,7 +89,7 @@ if [ ! -f ./config/settings.inc.php ] && [ ! -f ./install.lock ]; then runuser -g www-data -u www-data -- php -d memory_limit=-1 /var/www/html/$PS_FOLDER_INSTALL/index_cli.php \ --domain="$PS_DOMAIN" --db_server=$DB_SERVER:$DB_PORT --db_name="$DB_NAME" --db_user=$DB_USER \ --db_password=$DB_PASSWD --prefix="$DB_PREFIX" --firstname="John" --lastname="Doe" \ - --password=$ADMIN_PASSWD --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ + --password="$ADMIN_PASSWD" --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ --all_languages=$PS_ALL_LANGUAGES --newsletter=0 --send_email=0 --ssl=$PS_ENABLE_SSL if [ $? -ne 0 ]; then diff --git a/base/images/8.3-apache/Dockerfile b/base/images/8.3-apache/Dockerfile index 6d1ad846..1f199dfe 100644 --- a/base/images/8.3-apache/Dockerfile +++ b/base/images/8.3-apache/Dockerfile @@ -50,7 +50,7 @@ RUN docker-php-source extract \ && docker-php-source delete # Prepare install and CMD script -COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh /tmp/ +COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh config_files/docker_branch_run.sh /tmp/ # If handle dynamic domain COPY config_files/docker_updt_ps_domains.php /tmp/ diff --git a/base/images/8.3-apache/config_files/docker_branch_run.sh b/base/images/8.3-apache/config_files/docker_branch_run.sh new file mode 100755 index 00000000..7a24ceb8 --- /dev/null +++ b/base/images/8.3-apache/config_files/docker_branch_run.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +# Clone repository +if [ ! -f /var/www/html/composer.json ]; then + echo Clone PrestaShop $PS_BRANCH + git clone -b $PS_BRANCH https://github.com/PrestaShop/PrestaShop.git /var/www/html + chown -R www-data:www-data /var/www/html +fi + +# Install composer +if [ ! -f /usr/local/bin/composer ]; then + echo "\n* Install composer ..."; + mkdir -p /var/www/.composer + chown -R www-data:www-data /var/www/.composer + runuser -g www-data -u www-data -- php -r "copy('https://getcomposer.org/installer', '/tmp/composer-setup.php');" && php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer && rm -rf /tmp/composer-setup.php + if [ ! -f /usr/local/bin/composer ]; then + echo Composer installation failed + exit 1 + fi +fi + +# Install vendor dependencies +if [ ! -f /var/www/html/vendor/autoload.php ]; then + echo "\n* Running composer ..."; + pushd /var/www/html + # Execute composer as default user so that we can set the env variables to increase timeout, also disable default_socket_timeout for php + COMPOSER_PROCESS_TIMEOUT=600 COMPOSER_IPRESOLVE=4 php -ddefault_socket_timeout=-1 /usr/local/bin/composer install --ansi --prefer-dist --no-interaction --no-progress + # Update the owner of composer installed folders to be www-data + chown -R www-data:www-data vendor modules themes + popd +fi + +# Build assets +if [ "${DISABLE_MAKE}" != "1" ]; then + mkdir -p /var/www/.npm + chown -R www-data:www-data /var/www/.npm + + echo "\n* Install node $NODE_VERSION..."; + export NVM_DIR=/usr/local/nvm + mkdir -p $NVM_DIR \ + && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash \ + && . $NVM_DIR/nvm.sh \ + && nvm install $NODE_VERSION \ + && nvm alias default $NODE_VERSION \ + && nvm use default + + export NODE_PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin + export PATH=$PATH:$NODE_PATH + + pushd /var/www/html + echo "\n* Build assets ..."; + runuser -g www-data -u www-data -- /usr/bin/make assets + + echo "\n* Wait for assets built..."; + runuser -g www-data -u www-data -- /usr/bin/make wait-assets + popd +else + echo "\n* Build of assets was disabled..."; +fi + +/tmp/docker_run.sh diff --git a/base/images/8.3-apache/config_files/docker_run.sh b/base/images/8.3-apache/config_files/docker_run.sh index ea4faa82..5256a5a7 100755 --- a/base/images/8.3-apache/config_files/docker_run.sh +++ b/base/images/8.3-apache/config_files/docker_run.sh @@ -89,7 +89,7 @@ if [ ! -f ./config/settings.inc.php ] && [ ! -f ./install.lock ]; then runuser -g www-data -u www-data -- php -d memory_limit=-1 /var/www/html/$PS_FOLDER_INSTALL/index_cli.php \ --domain="$PS_DOMAIN" --db_server=$DB_SERVER:$DB_PORT --db_name="$DB_NAME" --db_user=$DB_USER \ --db_password=$DB_PASSWD --prefix="$DB_PREFIX" --firstname="John" --lastname="Doe" \ - --password=$ADMIN_PASSWD --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ + --password="$ADMIN_PASSWD" --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ --all_languages=$PS_ALL_LANGUAGES --newsletter=0 --send_email=0 --ssl=$PS_ENABLE_SSL if [ $? -ne 0 ]; then diff --git a/base/images/8.3-fpm/Dockerfile b/base/images/8.3-fpm/Dockerfile index 524ccd1e..20992dde 100644 --- a/base/images/8.3-fpm/Dockerfile +++ b/base/images/8.3-fpm/Dockerfile @@ -50,7 +50,7 @@ RUN docker-php-source extract \ && docker-php-source delete # Prepare install and CMD script -COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh /tmp/ +COPY config_files/ps-extractor.sh config_files/docker_run.sh config_files/docker_nightly_run.sh config_files/docker_branch_run.sh /tmp/ # If handle dynamic domain COPY config_files/docker_updt_ps_domains.php /tmp/ diff --git a/base/images/8.3-fpm/config_files/docker_branch_run.sh b/base/images/8.3-fpm/config_files/docker_branch_run.sh new file mode 100755 index 00000000..7a24ceb8 --- /dev/null +++ b/base/images/8.3-fpm/config_files/docker_branch_run.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +# Clone repository +if [ ! -f /var/www/html/composer.json ]; then + echo Clone PrestaShop $PS_BRANCH + git clone -b $PS_BRANCH https://github.com/PrestaShop/PrestaShop.git /var/www/html + chown -R www-data:www-data /var/www/html +fi + +# Install composer +if [ ! -f /usr/local/bin/composer ]; then + echo "\n* Install composer ..."; + mkdir -p /var/www/.composer + chown -R www-data:www-data /var/www/.composer + runuser -g www-data -u www-data -- php -r "copy('https://getcomposer.org/installer', '/tmp/composer-setup.php');" && php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer && rm -rf /tmp/composer-setup.php + if [ ! -f /usr/local/bin/composer ]; then + echo Composer installation failed + exit 1 + fi +fi + +# Install vendor dependencies +if [ ! -f /var/www/html/vendor/autoload.php ]; then + echo "\n* Running composer ..."; + pushd /var/www/html + # Execute composer as default user so that we can set the env variables to increase timeout, also disable default_socket_timeout for php + COMPOSER_PROCESS_TIMEOUT=600 COMPOSER_IPRESOLVE=4 php -ddefault_socket_timeout=-1 /usr/local/bin/composer install --ansi --prefer-dist --no-interaction --no-progress + # Update the owner of composer installed folders to be www-data + chown -R www-data:www-data vendor modules themes + popd +fi + +# Build assets +if [ "${DISABLE_MAKE}" != "1" ]; then + mkdir -p /var/www/.npm + chown -R www-data:www-data /var/www/.npm + + echo "\n* Install node $NODE_VERSION..."; + export NVM_DIR=/usr/local/nvm + mkdir -p $NVM_DIR \ + && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash \ + && . $NVM_DIR/nvm.sh \ + && nvm install $NODE_VERSION \ + && nvm alias default $NODE_VERSION \ + && nvm use default + + export NODE_PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin + export PATH=$PATH:$NODE_PATH + + pushd /var/www/html + echo "\n* Build assets ..."; + runuser -g www-data -u www-data -- /usr/bin/make assets + + echo "\n* Wait for assets built..."; + runuser -g www-data -u www-data -- /usr/bin/make wait-assets + popd +else + echo "\n* Build of assets was disabled..."; +fi + +/tmp/docker_run.sh diff --git a/base/images/8.3-fpm/config_files/docker_run.sh b/base/images/8.3-fpm/config_files/docker_run.sh index 6558a8a5..071b35ac 100755 --- a/base/images/8.3-fpm/config_files/docker_run.sh +++ b/base/images/8.3-fpm/config_files/docker_run.sh @@ -89,7 +89,7 @@ if [ ! -f ./config/settings.inc.php ] && [ ! -f ./install.lock ]; then runuser -g www-data -u www-data -- php -d memory_limit=-1 /var/www/html/$PS_FOLDER_INSTALL/index_cli.php \ --domain="$PS_DOMAIN" --db_server=$DB_SERVER:$DB_PORT --db_name="$DB_NAME" --db_user=$DB_USER \ --db_password=$DB_PASSWD --prefix="$DB_PREFIX" --firstname="John" --lastname="Doe" \ - --password=$ADMIN_PASSWD --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ + --password="$ADMIN_PASSWD" --email="$ADMIN_MAIL" --language=$PS_LANGUAGE --country=$PS_COUNTRY \ --all_languages=$PS_ALL_LANGUAGES --newsletter=0 --send_email=0 --ssl=$PS_ENABLE_SSL if [ $? -ne 0 ]; then diff --git a/build-local-docker.sh b/build-local-docker.sh new file mode 100755 index 00000000..45c86fec --- /dev/null +++ b/build-local-docker.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +PS_VERSION=nigthly +PHP_VERSION=8.3 +SERVER=apache + +if [ $# -gt 0 ]; then + PS_VERSION=$1 +fi +if [ $# -gt 1 ]; then + PHP_VERSION=$2 +fi +if [ $# -gt 2 ]; then + SERVER=$3 +fi + +echo Building PrestaShop $PS_VERSION with PHP $PHP_VERSION and Server $SERVER + +echo Building base image for PHP $PHP_VERSION with $SERVER +docker build base/images/$PHP_VERSION-$SERVER -t prestashop/base:$PHP_VERSION-$SERVER + +echo Building PrestaShop image for version $PS_VERSION +docker build images/$PS_VERSION/$PHP_VERSION-$SERVER -t prestashop/prestashop:$PS_VERSION-$PHP_VERSION-$SERVER + +echo Launching docker container with docker compose +PS_VERSION=$PS_VERSION PHP_VERSION=$PHP_VERSION SERVER=$SERVER docker compose -f images/docker-compose.yml up diff --git a/images/9.0.x/8.1-apache/Dockerfile b/images/9.0.x/8.1-apache/Dockerfile index a97ee5c8..deba0af4 100644 --- a/images/9.0.x/8.1-apache/Dockerfile +++ b/images/9.0.x/8.1-apache/Dockerfile @@ -4,6 +4,6 @@ LABEL maintainer="PrestaShop Core Team " RUN apt update RUN apt -y install git -RUN git clone -b 9.0.x https://github.com/PrestaShop/PrestaShop.git /tmp/data-ps +ENV PS_BRANCH=9.0.x -CMD ["/tmp/docker_run.sh"] +CMD ["/tmp/docker_branch_run.sh"] diff --git a/images/9.0.x/8.1-fpm/Dockerfile b/images/9.0.x/8.1-fpm/Dockerfile index 2edd2246..3e35d884 100644 --- a/images/9.0.x/8.1-fpm/Dockerfile +++ b/images/9.0.x/8.1-fpm/Dockerfile @@ -4,6 +4,6 @@ LABEL maintainer="PrestaShop Core Team " RUN apt update RUN apt -y install git -RUN git clone -b 9.0.x https://github.com/PrestaShop/PrestaShop.git /tmp/data-ps +ENV PS_BRANCH=9.0.x -CMD ["/tmp/docker_run.sh"] +CMD ["/tmp/docker_branch_run.sh"] diff --git a/images/9.0.x/8.2-apache/Dockerfile b/images/9.0.x/8.2-apache/Dockerfile index cb01b49b..d01b3a0f 100644 --- a/images/9.0.x/8.2-apache/Dockerfile +++ b/images/9.0.x/8.2-apache/Dockerfile @@ -4,6 +4,6 @@ LABEL maintainer="PrestaShop Core Team " RUN apt update RUN apt -y install git -RUN git clone -b 9.0.x https://github.com/PrestaShop/PrestaShop.git /tmp/data-ps +ENV PS_BRANCH=9.0.x -CMD ["/tmp/docker_run.sh"] +CMD ["/tmp/docker_branch_run.sh"] diff --git a/images/9.0.x/8.2-fpm/Dockerfile b/images/9.0.x/8.2-fpm/Dockerfile index 4b042509..01f64025 100644 --- a/images/9.0.x/8.2-fpm/Dockerfile +++ b/images/9.0.x/8.2-fpm/Dockerfile @@ -4,6 +4,6 @@ LABEL maintainer="PrestaShop Core Team " RUN apt update RUN apt -y install git -RUN git clone -b 9.0.x https://github.com/PrestaShop/PrestaShop.git /tmp/data-ps +ENV PS_BRANCH=9.0.x -CMD ["/tmp/docker_run.sh"] +CMD ["/tmp/docker_branch_run.sh"] diff --git a/images/9.0.x/8.3-apache/Dockerfile b/images/9.0.x/8.3-apache/Dockerfile index 094eed98..98f3adc5 100644 --- a/images/9.0.x/8.3-apache/Dockerfile +++ b/images/9.0.x/8.3-apache/Dockerfile @@ -4,6 +4,6 @@ LABEL maintainer="PrestaShop Core Team " RUN apt update RUN apt -y install git -RUN git clone -b 9.0.x https://github.com/PrestaShop/PrestaShop.git /tmp/data-ps +ENV PS_BRANCH=9.0.x -CMD ["/tmp/docker_run.sh"] +CMD ["/tmp/docker_branch_run.sh"] diff --git a/images/9.0.x/8.3-fpm/Dockerfile b/images/9.0.x/8.3-fpm/Dockerfile index feb3eba4..acf013a8 100644 --- a/images/9.0.x/8.3-fpm/Dockerfile +++ b/images/9.0.x/8.3-fpm/Dockerfile @@ -4,6 +4,6 @@ LABEL maintainer="PrestaShop Core Team " RUN apt update RUN apt -y install git -RUN git clone -b 9.0.x https://github.com/PrestaShop/PrestaShop.git /tmp/data-ps +ENV PS_BRANCH=9.0.x -CMD ["/tmp/docker_run.sh"] +CMD ["/tmp/docker_branch_run.sh"] diff --git a/images/docker-compose.yml b/images/docker-compose.yml new file mode 100644 index 00000000..7d888cc9 --- /dev/null +++ b/images/docker-compose.yml @@ -0,0 +1,47 @@ +version: '2.1' + +services: + mysql: + image: mysql:8 + ports: + - "3306:3306" + environment: + MYSQL_ROOT_PASSWORD: ${DB_PASSWD:-prestashop} + MYSQL_DATABASE: ${DB_NAME:-prestashop} + restart: unless-stopped + networks: + - prestashop-network + + prestashop: + image: prestashop/prestashop:${PS_VERSION}-${PHP_VERSION}-${SERVER:-apache} + container_name: prestashop + depends_on: + - mysql + environment: + DISABLE_MAKE: ${DISABLE_MAKE:-0} + PS_INSTALL_AUTO: ${PS_INSTALL_AUTO:-1} + DB_PASSWD: ${DB_PASSWD:-prestashop} + DB_NAME: ${DB_NAME:-prestashop} + DB_SERVER: ${DB_SERVER:-mysql} + DB_PREFIX: ${DB_PREFIX:-ps_} + PS_DOMAIN: ${PS_DOMAIN:-localhost:8001} + PS_FOLDER_INSTALL: ${PS_FOLDER_INSTALL:-install-dev} + PS_FOLDER_ADMIN: ${PS_FOLDER_ADMIN:-admin-dev} + PS_COUNTRY: ${PS_COUNTRY:-fr} + PS_LANGUAGE: ${PS_LANGUAGE:-en} + PS_DEV_MODE: ${PS_DEV_MODE:-1} + PS_ENABLE_SSL: ${PS_ENABLE_SSL:-0} + PS_ERASE_DB: ${PS_ERASE_DB:-0} + PS_USE_DOCKER_MAILDEV: ${PS_USE_DOCKER_MAILDEV:-1} + ADMIN_MAIL: ${ADMIN_MAIL:-demo@prestashop.com} + ADMIN_PASSWD: ${ADMIN_PASSWD:-Correct Horse Battery Staple} + NODE_VERSION: ${NODE_VERSION:-v20.17.0} + ports: + - "8001:80" + - "8002:443" + networks: + - prestashop-network + +networks: + prestashop-network: + name: prestashop-network diff --git a/tests/prestashop_docker/test_generator.py b/tests/prestashop_docker/test_generator.py index 40202b4c..ddc52c4f 100644 --- a/tests/prestashop_docker/test_generator.py +++ b/tests/prestashop_docker/test_generator.py @@ -29,7 +29,7 @@ def setUp(self): contents=''' CONTAINER_VERSION: $container_version RUN apt -y install git - RUN git clone -b $branch_version https://github.com/PrestaShop/PrestaShop.git /tmp/data-ps + ENV PS_BRANCH=$branch_version ''' ) @@ -156,7 +156,7 @@ def test_generate_branch_image(self): ) self.assertIn('CONTAINER_VERSION: 8.1-alpine', content) self.assertIn('RUN apt -y install git', content) - self.assertIn('RUN git clone -b 9.0.x https://github.com/PrestaShop/PrestaShop.git /tmp/data-ps', content) + self.assertIn('ENV PS_BRANCH=9.0.x', content) def test_generate_all(self): files = (