Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(build): old base image #148

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
48 changes: 18 additions & 30 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,39 +80,32 @@ jobs:
env:
PS_VERSION: ${{ matrix.ps_version }}
REBUILD_BASE: "true"
TARGET_IMAGE: "flashlight:${{ matrix.ps_version }}"

- name: Test the image with a dry run
run: docker run --env PS_DOMAIN='localhost:80' --env DRY_RUN='true' $DOCKER_IMAGE
env:
DOCKER_IMAGE: prestashop/prestashop-flashlight:${{ matrix.ps_version }}
run: docker run --env PS_DOMAIN='localhost:80' --env DRY_RUN='true' flashlight:${{ matrix.ps_version }}

- name: Test the image tooling(composer)
run: docker run --env PS_DOMAIN='localhost:80' --entrypoint composer $DOCKER_IMAGE --version
env:
DOCKER_IMAGE: prestashop/prestashop-flashlight:${{ matrix.ps_version }}
run: docker run --env PS_DOMAIN='localhost:80' --entrypoint composer flashlight:${{ matrix.ps_version }} --version

- name: Test the image tooling(phpunit)
run: docker run --env PS_DOMAIN='localhost:80' --entrypoint phpunit $DOCKER_IMAGE --version
env:
DOCKER_IMAGE: prestashop/prestashop-flashlight:${{ matrix.ps_version }}
run: docker run --env PS_DOMAIN='localhost:80' --entrypoint phpunit flashlight:${{ matrix.ps_version }} --version

- name: Test the image tooling(phpstan)
run: docker run --env PS_DOMAIN='localhost:80' --entrypoint phpstan $DOCKER_IMAGE --version
env:
DOCKER_IMAGE: prestashop/prestashop-flashlight:${{ matrix.ps_version }}
run: docker run --env PS_DOMAIN='localhost:80' --entrypoint phpstan flashlight:${{ matrix.ps_version }} --version

- name: Test the image tooling(xdebug)
run: docker run --env PS_DOMAIN='localhost:80' --entrypoint bash $DOCKER_IMAGE -c 'php -m -c | grep xdebug'
env:
DOCKER_IMAGE: prestashop/prestashop-flashlight:${{ matrix.ps_version }}
run: docker run --env PS_DOMAIN='localhost:80' --entrypoint bash flashlight:${{ matrix.ps_version }} -c 'php -m -c | grep xdebug'

docker_build_old_php:
name: "Docker build: PrestaShop with PHP 5.6"
docker_build_base:
name: "Docker build: PrestaShop with PHP ${{ matrix.php_version }} ${{ matrix.os_version }}"
runs-on: ubuntu-latest
timeout-minutes: 45
strategy:
fail-fast: true
matrix:
php_version:
["5.6", "7.0", "7.1", "7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3"]
os_version: ["alpine", "debian"]
needs: [docker_dry_build]
steps:
Expand All @@ -122,15 +115,13 @@ jobs:
- name: Call the docker build chain
run: ./build.sh
env:
PS_VERSION: 1.6.1.24
PHP_VERSION: 5.6
OS_VERSION: ${{ matrix.os_version }}
REBUILD_BASE: "true"
PHP_VERSION: ${{ matrix.php_version }}
OS_FLAVOUR: ${{ matrix.os_version }}
TARGET_IMAGE: "flashlight:test"
BASE_ONLY: "true"

- name: Test the image with a dry run
run: docker run --env PS_DOMAIN='localhost:80' --env DRY_RUN='true' $DOCKER_IMAGE
env:
DOCKER_IMAGE: prestashop/prestashop-flashlight:1.6.1.24-${{ matrix.os_version }}
run: docker run --env PS_DOMAIN='localhost:80' --env DRY_RUN='true' --user www-data flashlight:test

docker_build_debian:
name: "Docker build: PS ${{ matrix.ps_version }} for debian"
Expand All @@ -150,17 +141,14 @@ jobs:
env:
OS_FLAVOUR: "debian"
PS_VERSION: ${{ matrix.ps_version }}
TARGET_IMAGE: "flashlight:${{ matrix.ps_version }}-debian"
REBUILD_BASE: "true"

- name: Test the image with a dry run
run: docker run --env PS_DOMAIN='localhost:80' --env DRY_RUN='true' $DOCKER_IMAGE
env:
DOCKER_IMAGE: prestashop/prestashop-flashlight:${{ matrix.ps_version }}-debian
run: docker run --env PS_DOMAIN='localhost:80' --env DRY_RUN='true' flashlight:${{ matrix.ps_version }}-debian

- name: The image has a PrestaShop console CLI
run: docker run --env PS_DOMAIN='localhost:80' --entrypoint /bin/ls $DOCKER_IMAGE bin/console
env:
DOCKER_IMAGE: prestashop/prestashop-flashlight:${{ matrix.ps_version }}-debian
run: docker run --env PS_DOMAIN='localhost:80' --entrypoint /bin/ls flashlight:${{ matrix.ps_version }}-debian bin/console

docker_build_nightly:
name: "Docker build: PS nightly"
Expand Down
33 changes: 30 additions & 3 deletions assets/alpine-base-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@ set -eu
# Install base tools, PHP requirements and dev-tools
packages="bash less vim geoip git tzdata zip curl jq autoconf findutils \
ca-certificates \
php-common php-iconv php-gd mariadb-client sudo libjpeg libxml2 \
mariadb-client sudo libjpeg libxml2 \
build-base linux-headers freetype-dev zlib-dev libjpeg-turbo-dev \
libpng-dev oniguruma-dev libzip-dev icu-dev libmcrypt-dev libxml2-dev \
openssh-client libcap shadow"

if [ "$PHP_VERSION" = "7.0" ] || [ "$PHP_VERSION" = "7.1" ] || [ "$PHP_VERSION" = "7.2" ]; then
packages="$packages php7-common php7-iconv php7-gd"
else
packages="$packages php-common php-iconv php-gd"
fi

if [ "$SERVER_FLAVOUR" = "nginx" ]; then
packages="$packages nginx nginx-mod-http-headers-more nginx-mod-http-geoip nginx-mod-stream nginx-mod-stream-geoip"
else
Expand Down Expand Up @@ -99,7 +105,13 @@ fi
# Install phpstan
PHPSTAN_VERSION=$(jq -r '."'"${PHP_SHORT_VERSION}"'".phpstan' < /tmp/php-flavours.json)
if [ "$PHPSTAN_VERSION" != "null" ]; then
wget -q -O /usr/bin/phpstan "https://github.com/phpstan/phpstan/raw/${PHPSTAN_VERSION}/phpstan.phar"

PHP_STAN_DL_URL="https://github.com/phpstan/phpstan/releases/download/${PHPSTAN_VERSION}/phpstan.phar"
if [ "$PHPSTAN_VERSION" = "HEAD" ]; then
PHP_STAN_DL_URL="https://github.com/phpstan/phpstan/raw/HEAD/phpstan.phar"
fi

wget -q -O /usr/bin/phpstan "$PHP_STAN_DL_URL"
chmod a+x /usr/bin/phpstan
fi

Expand All @@ -119,7 +131,22 @@ fi

# Install Node.js (shipping yarn and npm) and pnpm
if [ "0.0.0" != "$NODE_VERSION" ]; then
apk --no-cache add -U python3 nodejs npm yarn
packagesForNode=python3
if [ "$PHP_VERSION" = "7.0" ] || [ "$PHP_VERSION" = "7.1" ] || [ "$PHP_VERSION" = "7.2" ]; then
packagesForNode="$packagesForNode nodejs-npm yarn"
else
packagesForNode="$packagesForNode nodejs npm yarn"
fi
# shellcheck disable=SC2086
set -- $packagesForNode
apk --no-cache add -U "$@"

# see https://stackoverflow.com/a/52196681
NODE_MAJOR_VERSION=$(node -v | cut -d '.' -f1 | tr -d 'v')
if [ "$NODE_MAJOR_VERSION" -lt 14 ]; then
npm config set unsafe-perm true
fi

npm install -g pnpm@latest
fi

Expand Down
22 changes: 13 additions & 9 deletions assets/debian-base-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,19 @@ rm -rf /usr/share/doc \
/usr/share/locale

# Get debian version and codename
VERSION_CODENAME=""
# shellcheck disable=SC1091
. /etc/os-release
if [ "$VERSION_ID" = 9 ]; then
if [ "$VERSION_ID" = 8 ]; then
export VERSION_CODENAME="jessie";
elif [ "$VERSION_ID" = 9 ]; then
export VERSION_CODENAME="stretch";
fi

# https://unix.stackexchange.com/a/743874
if [ "$VERSION_CODENAME" = "stretch" ]; then
if [ "$VERSION_CODENAME" = "jessie" ]; then
echo "deb [check-valid-until=no] http://archive.debian.org/debian/ jessie main contrib non-free" > /etc/apt/sources.list
elif [ "$VERSION_CODENAME" = "stretch" ]; then
sed -i s/deb.debian.org/archive.debian.org/g /etc/apt/sources.list
sed -i s/security.debian.org/archive.debian.org/g /etc/apt/sources.list
sed -i s/stretch-updates/stretch/g /etc/apt/sources.list
Expand All @@ -32,21 +37,20 @@ curl -s -L -H "Content-Type: application/octet-stream" \
--data-binary "@/etc/apt/trusted.gpg.d/php.gpg" \
"https://packages.sury.org/php/apt.gpg"
apt-get update
apt-get install --no-install-recommends -qqy apt-transport-https ca-certificates
apt-get install --no-install-recommends --force-yes -qqy apt-transport-https ca-certificates
LIB_GNUTLS=$(apt-cache search '^libgnutls' | awk 'NR==1{print $1}')
packages=(bash less vim git sudo mariadb-client \
tzdata zip unzip curl wget make jq netcat-traditional build-essential \
lsb-release libgnutls30 gnupg libiconv-hook1 libonig-dev libnginx-mod-http-headers-more-filter libnginx-mod-http-geoip \
libnginx-mod-http-geoip libnginx-mod-stream openssh-client libcap2-bin)
lsb-release "$LIB_GNUTLS" gnupg libiconv-hook1 libonig-dev openssh-client libcap2-bin)
if [ "$SERVER_FLAVOUR" = "nginx" ]; then
packages+=(nginx)
packages+=(nginx-full)
else
packages+=(apache2)
fi

apt-get install --no-install-recommends -o Dpkg::Options::="--force-confold" -qqy "${packages[@]}"
apt-get install --no-install-recommends -o Dpkg::Options::="--force-confold" --force-yes -qqy "${packages[@]}"


if [ "$VERSION_CODENAME" != "stretch" ] && [ "$VERSION_CODENAME" != "buster" ]; then
if [ "$VERSION_CODENAME" != "stretch" ] && [ "$VERSION_CODENAME" != "buster" ] && [ "$VERSION_CODENAME" != "jessie" ]; then
echo "deb [trusted=yes] https://packages.sury.org/php/ $VERSION_CODENAME main" > /etc/apt/sources.list.d/php.list
fi
rm /etc/apt/preferences.d/no-debian-php
Expand Down
3 changes: 2 additions & 1 deletion assets/hydrate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ PS_OPT_DIR=/var/opt/prestashop
mkdir -p "$PS_OPT_DIR"
if echo "$PS_VERSION" | grep "^1.6" > /dev/null; then
cp "$PS_FOLDER/config/settings.inc.php" "$PS_OPT_DIR/settings.inc.php"
elif [ -f "$PS_FOLDER/app/config/parameters.yml.dist" ]; then
cp "$PS_FOLDER/app/config/parameters.yml.dist" "$PS_OPT_DIR/parameters.yml"
else
mkdir -p "$PS_OPT_DIR"
cp "$PS_FOLDER/app/config/parameters.php" "$PS_OPT_DIR/parameters.php"
fi

Expand Down
Loading
Loading