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 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
1 change: 1 addition & 0 deletions assets/debian-base-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ 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
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