Skip to content

Commit

Permalink
Use nightly build (rather than buiild it)
Browse files Browse the repository at this point in the history
  • Loading branch information
Progi1984 committed Nov 29, 2024
1 parent 3fc902c commit a367978
Show file tree
Hide file tree
Showing 64 changed files with 801 additions and 1,225 deletions.
18 changes: 14 additions & 4 deletions Dockerfile-branch.model
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
FROM prestashop/base:$container_version
LABEL maintainer="PrestaShop Core Team <[email protected]>"

ENV PS_VERSION $branch_version

ENV PATH /root/google-cloud-sdk/bin/:$$PATH

RUN apt update
RUN apt -y install git
RUN apt -y install \
python3 \
curl \
bash

ENV PS_BRANCH=$branch_version
ENV NODE_VERSION=$node_version
RUN curl -sSL https://sdk.cloud.google.com | bash
RUN gcloud config set core/disable_usage_reporting true && \
gcloud config set component_manager/disable_update_check true && \
gcloud config set metrics/environment github_docker_image && \
gcloud --version

CMD ["/tmp/docker_branch_run.sh"]
CMD ["/tmp/docker_nightly_run.sh"]
64 changes: 9 additions & 55 deletions base/config_files/docker_branch_run.sh
Original file line number Diff line number Diff line change
@@ -1,62 +1,16 @@
#!/bin/bash
#!/bin/sh

# 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 (vendor are always installed)
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 unless make is disabled (which can b the case when we only need PHP dependencies in CI)
# If auto install is enabled though we must build the assets
if [ "${DISABLE_MAKE}" != "1" ] || [ "${PS_INSTALL_AUTO}" == "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
# Download branch build
if [ ! -d /tmp/data-ps ]; then
gsutil cp `gsutil ls gs://prestashop-core-nightly/ | grep -E '$PS_VERSION.+\.zip$' | tail -1` /tmp/prestashop.zip

export NODE_PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin
export PATH=$PATH:$NODE_PATH
mkdir -p /tmp/data-ps
unzip -q /tmp/prestashop.zip -d /tmp/data-ps/

pushd /var/www/html
echo "\n* Build assets ...";
runuser -g www-data -u www-data -- /usr/bin/make assets
bash /tmp/ps-extractor.sh /tmp/data-ps

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...";
# Remove downloaded zip
rm /tmp/prestashop.zip
fi

/tmp/docker_run.sh
64 changes: 9 additions & 55 deletions base/images/7.1-apache/config_files/docker_branch_run.sh
Original file line number Diff line number Diff line change
@@ -1,62 +1,16 @@
#!/bin/bash
#!/bin/sh

# 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 (vendor are always installed)
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 unless make is disabled (which can b the case when we only need PHP dependencies in CI)
# If auto install is enabled though we must build the assets
if [ "${DISABLE_MAKE}" != "1" ] || [ "${PS_INSTALL_AUTO}" == "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
# Download nightly build
if [ ! -d /tmp/data-ps ]; then
gsutil cp `gsutil ls gs://prestashop-core-nightly/ | grep -E '$PS_VERSION.+\.zip$' | tail -1` /tmp/prestashop.zip

export NODE_PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin
export PATH=$PATH:$NODE_PATH
mkdir -p /tmp/data-ps
unzip -q /tmp/prestashop.zip -d /tmp/data-ps/

pushd /var/www/html
echo "\n* Build assets ...";
runuser -g www-data -u www-data -- /usr/bin/make assets
bash /tmp/ps-extractor.sh /tmp/data-ps

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...";
# Remove downloaded zip
rm /tmp/prestashop.zip
fi

/tmp/docker_run.sh
64 changes: 9 additions & 55 deletions base/images/7.1-fpm/config_files/docker_branch_run.sh
Original file line number Diff line number Diff line change
@@ -1,62 +1,16 @@
#!/bin/bash
#!/bin/sh

# 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 (vendor are always installed)
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 unless make is disabled (which can b the case when we only need PHP dependencies in CI)
# If auto install is enabled though we must build the assets
if [ "${DISABLE_MAKE}" != "1" ] || [ "${PS_INSTALL_AUTO}" == "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
# Download nightly build
if [ ! -d /tmp/data-ps ]; then
gsutil cp `gsutil ls gs://prestashop-core-nightly/ | grep -E '$PS_VERSION.+\.zip$' | tail -1` /tmp/prestashop.zip

export NODE_PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin
export PATH=$PATH:$NODE_PATH
mkdir -p /tmp/data-ps
unzip -q /tmp/prestashop.zip -d /tmp/data-ps/

pushd /var/www/html
echo "\n* Build assets ...";
runuser -g www-data -u www-data -- /usr/bin/make assets
bash /tmp/ps-extractor.sh /tmp/data-ps

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...";
# Remove downloaded zip
rm /tmp/prestashop.zip
fi

/tmp/docker_run.sh
64 changes: 9 additions & 55 deletions base/images/7.2-apache/config_files/docker_branch_run.sh
Original file line number Diff line number Diff line change
@@ -1,62 +1,16 @@
#!/bin/bash
#!/bin/sh

# 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 (vendor are always installed)
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 unless make is disabled (which can b the case when we only need PHP dependencies in CI)
# If auto install is enabled though we must build the assets
if [ "${DISABLE_MAKE}" != "1" ] || [ "${PS_INSTALL_AUTO}" == "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
# Download nightly build
if [ ! -d /tmp/data-ps ]; then
gsutil cp `gsutil ls gs://prestashop-core-nightly/ | grep -E '$PS_VERSION.+\.zip$' | tail -1` /tmp/prestashop.zip

export NODE_PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin
export PATH=$PATH:$NODE_PATH
mkdir -p /tmp/data-ps
unzip -q /tmp/prestashop.zip -d /tmp/data-ps/

pushd /var/www/html
echo "\n* Build assets ...";
runuser -g www-data -u www-data -- /usr/bin/make assets
bash /tmp/ps-extractor.sh /tmp/data-ps

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...";
# Remove downloaded zip
rm /tmp/prestashop.zip
fi

/tmp/docker_run.sh
64 changes: 9 additions & 55 deletions base/images/7.2-fpm/config_files/docker_branch_run.sh
Original file line number Diff line number Diff line change
@@ -1,62 +1,16 @@
#!/bin/bash
#!/bin/sh

# 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 (vendor are always installed)
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 unless make is disabled (which can b the case when we only need PHP dependencies in CI)
# If auto install is enabled though we must build the assets
if [ "${DISABLE_MAKE}" != "1" ] || [ "${PS_INSTALL_AUTO}" == "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
# Download nightly build
if [ ! -d /tmp/data-ps ]; then
gsutil cp `gsutil ls gs://prestashop-core-nightly/ | grep -E '$PS_VERSION.+\.zip$' | tail -1` /tmp/prestashop.zip

export NODE_PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin
export PATH=$PATH:$NODE_PATH
mkdir -p /tmp/data-ps
unzip -q /tmp/prestashop.zip -d /tmp/data-ps/

pushd /var/www/html
echo "\n* Build assets ...";
runuser -g www-data -u www-data -- /usr/bin/make assets
bash /tmp/ps-extractor.sh /tmp/data-ps

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...";
# Remove downloaded zip
rm /tmp/prestashop.zip
fi

/tmp/docker_run.sh
Loading

0 comments on commit a367978

Please sign in to comment.