From e618534e4f1df82902fd54f1d4f8b8d93c595ff3 Mon Sep 17 00:00:00 2001
From: Kentaro Ohkouchi <nanasess@fsm.ne.jp>
Date: Wed, 13 Sep 2023 22:41:03 +0900
Subject: [PATCH 1/2] =?UTF-8?q?debian-stretch=20=E3=81=8C=20archive=20?=
 =?UTF-8?q?=E3=81=B8=E7=A7=BB=E5=8B=95=E3=81=97=E3=81=9F=E3=81=9F=E3=82=81?=
 =?UTF-8?q?=20sources.list=20=E3=82=92=E4=BF=AE=E6=AD=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

archive.debian.org は遅いので cloudfront の mirror を使用する
---
 .github/workflows/dockerbuild.yml | 40 +++++++++++++++++++++++++++----
 .github/workflows/e2e-tests.yml   | 40 ++++++++++++++++++++++++++-----
 Dockerfile                        | 16 ++++++++++---
 3 files changed, 82 insertions(+), 14 deletions(-)

diff --git a/.github/workflows/dockerbuild.yml b/.github/workflows/dockerbuild.yml
index e6cdd862bc..592bcf81e7 100644
--- a/.github/workflows/dockerbuild.yml
+++ b/.github/workflows/dockerbuild.yml
@@ -21,7 +21,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        php: [ '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1' ]
+        php: [ '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ]
 
     steps:
       - name: downcase REPO
@@ -32,26 +32,50 @@ jobs:
         run: |
           echo "GD_OPTIONS=--with-freetype-dir=/usr/include --with-jpeg-dir=/usr/include" >> ${GITHUB_ENV}
           echo "EXT_INSTALL_ARGS=gd zip mysqli pgsql mbstring" >> ${GITHUB_ENV}
-          echo "APCU=apcu-4.0.11" >>  ${GITHUB_ENV}
+          echo "APCU=apcu-4.0.11" >> ${GITHUB_ENV}
+          echo "FORCE_YES=--force-yes" >> ${GITHUB_ENV}
+          echo "APT_REPO=cloudfront.debian.net/debian-archive" >> ${GITHUB_ENV}
+          echo "APT_SECURITY_REPO=cloudfront.debian.net/debian-archive/debian-security" >> ${GITHUB_ENV}
+      - if: ${{ matrix.php == 5.5 }}
+        run: |
+          echo "GD_OPTIONS=--with-freetype-dir=/usr/include --with-jpeg-dir=/usr/include" >> ${GITHUB_ENV}
+          echo "EXT_INSTALL_ARGS=gd zip mysqli pgsql opcache" >> ${GITHUB_ENV}
+          echo "APCU=" >>  ${GITHUB_ENV}
           echo "FORCE_YES=--force-yes" >>  ${GITHUB_ENV}
-      - if: ${{ matrix.php == 5.5 || matrix.php == 5.6 }}
+          echo "APT_REPO=cloudfront.debian.net/debian-archive" >> ${GITHUB_ENV}
+          echo "APT_SECURITY_REPO=cloudfront.debian.net/debian-archive/debian-security" >> ${GITHUB_ENV}
+      - if: ${{ matrix.php == 5.6 }}
         run: |
           echo "GD_OPTIONS=--with-freetype-dir=/usr/include --with-jpeg-dir=/usr/include" >> ${GITHUB_ENV}
           echo "EXT_INSTALL_ARGS=gd zip mysqli pgsql opcache" >> ${GITHUB_ENV}
-          echo "APCU=apcu-4.0.11" >>  ${GITHUB_ENV}
+          echo "APCU=" >>  ${GITHUB_ENV}
           echo "FORCE_YES=--force-yes" >>  ${GITHUB_ENV}
-      - if: ${{ matrix.php >= 7.0 && matrix.php <= 7.3 }}
+          echo "APT_REPO=cloudfront.debian.net/debian-archive" >> ${GITHUB_ENV}
+          echo "APT_SECURITY_REPO=cloudfront.debian.net/debian-archive" >> ${GITHUB_ENV}
+      - if: ${{ matrix.php == 7.0 }}
+        run: |
+          echo "GD_OPTIONS=--with-freetype-dir=/usr/include --with-jpeg-dir=/usr/include" >> ${GITHUB_ENV}
+          echo "EXT_INSTALL_ARGS=gd zip mysqli pgsql opcache" >> ${GITHUB_ENV}
+          echo "APCU=apcu" >>  ${GITHUB_ENV}
+          echo "FORCE_YES=" >>  ${GITHUB_ENV}
+          echo "APT_REPO=cloudfront.debian.net/debian-archive" >> ${GITHUB_ENV}
+          echo "APT_SECURITY_REPO=cloudfront.debian.net/debian-archive" >> ${GITHUB_ENV}
+      - if: ${{ matrix.php >= 7.1 && matrix.php <= 7.3 }}
         run: |
           echo "GD_OPTIONS=--with-freetype-dir=/usr/include --with-jpeg-dir=/usr/include" >> ${GITHUB_ENV}
           echo "EXT_INSTALL_ARGS=gd zip mysqli pgsql opcache" >> ${GITHUB_ENV}
           echo "APCU=apcu" >>  ${GITHUB_ENV}
           echo "FORCE_YES=" >>  ${GITHUB_ENV}
+          echo "APT_REPO=deb.debian.org" >> ${GITHUB_ENV}
+          echo "APT_SECURITY_REPO=security.debian.org" >> ${GITHUB_ENV}
       - if: ${{ matrix.php >= 7.4 }}
         run: |
           echo "GD_OPTIONS=--with-freetype --with-jpeg" >> ${GITHUB_ENV}
           echo "EXT_INSTALL_ARGS=gd zip mysqli pgsql opcache" >> ${GITHUB_ENV}
           echo "APCU=apcu" >>  ${GITHUB_ENV}
           echo "FORCE_YES=" >>  ${GITHUB_ENV}
+          echo "APT_REPO=deb.debian.org" >> ${GITHUB_ENV}
+          echo "APT_SECURITY_REPO=security.debian.org" >> ${GITHUB_ENV}
 
       - name: Checkout
         uses: actions/checkout@v3
@@ -97,6 +121,9 @@ jobs:
             GD_OPTIONS=${{ env.GD_OPTIONS }}
             EXT_INSTALL_ARGS=${{ env.EXT_INSTALL_ARGS }}
             APCU=${{ env.APCU }}
+            FORCE_YES=${{ env.FORCE_YES }}
+            APT_REPO=${{ env.APT_REPO }}
+            APT_SECURITY_REPO=${{ env.APT_SECURITY_REPO }}
 
       - name: Setup to EC-CUBE
         env:
@@ -142,6 +169,9 @@ jobs:
             GD_OPTIONS=${{ env.GD_OPTIONS }}
             EXT_INSTALL_ARGS=${{ env.EXT_INSTALL_ARGS }}
             APCU=${{ env.APCU }}
+            FORCE_YES=${{ env.FORCE_YES }}
+            APT_REPO=${{ env.APT_REPO }}
+            APT_SECURITY_REPO=${{ env.APT_SECURITY_REPO }}
 
       - name: Upload evidence
         if: failure()
diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml
index f12c5d3442..3f15f1646e 100644
--- a/.github/workflows/e2e-tests.yml
+++ b/.github/workflows/e2e-tests.yml
@@ -89,7 +89,7 @@ jobs:
       fail-fast: false
       matrix:
         db: [ 'pgsql', 'mysql' ]
-        php: [ '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1' ]
+        php: [ '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ]
         include:
           - db: mysql
             dbport: '3306'
@@ -109,22 +109,50 @@ jobs:
       run: |
         echo "GD_OPTIONS=--with-freetype-dir=/usr/include --with-jpeg-dir=/usr/include" >> ${GITHUB_ENV}
         echo "EXT_INSTALL_ARGS=gd zip mysqli pgsql mbstring" >> ${GITHUB_ENV}
-        echo "APCU=apcu-4.0.11" >>  ${GITHUB_ENV}
-    - if: ${{ matrix.php == 5.5 || matrix.php == 5.6 }}
+        echo "APCU=apcu-4.0.11" >> ${GITHUB_ENV}
+        echo "FORCE_YES=--force-yes" >> ${GITHUB_ENV}
+        echo "APT_REPO=cloudfront.debian.net/debian-archive" >> ${GITHUB_ENV}
+        echo "APT_SECURITY_REPO=cloudfront.debian.net/debian-archive/debian-security" >> ${GITHUB_ENV}
+    - if: ${{ matrix.php == 5.5 }}
       run: |
         echo "GD_OPTIONS=--with-freetype-dir=/usr/include --with-jpeg-dir=/usr/include" >> ${GITHUB_ENV}
         echo "EXT_INSTALL_ARGS=gd zip mysqli pgsql opcache" >> ${GITHUB_ENV}
-        echo "APCU=apcu-4.0.11" >>  ${GITHUB_ENV}
-    - if: ${{ matrix.php >= 7.0 && matrix.php <= 7.3 }}
+        echo "APCU=" >>  ${GITHUB_ENV}
+        echo "FORCE_YES=--force-yes" >>  ${GITHUB_ENV}
+        echo "APT_REPO=cloudfront.debian.net/debian-archive" >> ${GITHUB_ENV}
+        echo "APT_SECURITY_REPO=cloudfront.debian.net/debian-archive/debian-security" >> ${GITHUB_ENV}
+    - if: ${{ matrix.php == 5.6 }}
+      run: |
+        echo "GD_OPTIONS=--with-freetype-dir=/usr/include --with-jpeg-dir=/usr/include" >> ${GITHUB_ENV}
+        echo "EXT_INSTALL_ARGS=gd zip mysqli pgsql opcache" >> ${GITHUB_ENV}
+        echo "APCU=" >>  ${GITHUB_ENV}
+        echo "FORCE_YES=--force-yes" >>  ${GITHUB_ENV}
+        echo "APT_REPO=cloudfront.debian.net/debian-archive" >> ${GITHUB_ENV}
+        echo "APT_SECURITY_REPO=cloudfront.debian.net/debian-archive" >> ${GITHUB_ENV}
+    - if: ${{ matrix.php == 7.0 }}
+      run: |
+        echo "GD_OPTIONS=--with-freetype-dir=/usr/include --with-jpeg-dir=/usr/include" >> ${GITHUB_ENV}
+        echo "EXT_INSTALL_ARGS=gd zip mysqli pgsql opcache" >> ${GITHUB_ENV}
+        echo "APCU=apcu" >>  ${GITHUB_ENV}
+        echo "FORCE_YES=" >>  ${GITHUB_ENV}
+        echo "APT_REPO=cloudfront.debian.net/debian-archive" >> ${GITHUB_ENV}
+        echo "APT_SECURITY_REPO=cloudfront.debian.net/debian-archive" >> ${GITHUB_ENV}
+    - if: ${{ matrix.php >= 7.1 && matrix.php <= 7.3 }}
       run: |
         echo "GD_OPTIONS=--with-freetype-dir=/usr/include --with-jpeg-dir=/usr/include" >> ${GITHUB_ENV}
         echo "EXT_INSTALL_ARGS=gd zip mysqli pgsql opcache" >> ${GITHUB_ENV}
         echo "APCU=apcu" >>  ${GITHUB_ENV}
+        echo "FORCE_YES=" >>  ${GITHUB_ENV}
+        echo "APT_REPO=deb.debian.org" >> ${GITHUB_ENV}
+        echo "APT_SECURITY_REPO=security.debian.org" >> ${GITHUB_ENV}
     - if: ${{ matrix.php >= 7.4 }}
       run: |
         echo "GD_OPTIONS=--with-freetype --with-jpeg" >> ${GITHUB_ENV}
         echo "EXT_INSTALL_ARGS=gd zip mysqli pgsql opcache" >> ${GITHUB_ENV}
         echo "APCU=apcu" >>  ${GITHUB_ENV}
+        echo "FORCE_YES=" >>  ${GITHUB_ENV}
+        echo "APT_REPO=deb.debian.org" >> ${GITHUB_ENV}
+        echo "APT_SECURITY_REPO=security.debian.org" >> ${GITHUB_ENV}
 
     - name: Checkout
       uses: actions/checkout@v3
@@ -142,7 +170,7 @@ jobs:
         sudo chown -R 1001:1000 zap
         sudo chmod -R g+w zap
         sh -c 'echo "<?php" >> data/config/config.php'
-        docker build -t ec-cube2 --build-arg PHP_VERSION_TAG="${PHP_VERSION_TAG}" --build-arg GD_OPTIONS="${GD_OPTIONS}" --build-arg EXT_INSTALL_ARGS="${EXT_INSTALL_ARGS}" --build-arg APCU="${APCU}" .
+        docker build -t ec-cube2 --build-arg PHP_VERSION_TAG="${PHP_VERSION_TAG}" --build-arg GD_OPTIONS="${GD_OPTIONS}" --build-arg EXT_INSTALL_ARGS="${EXT_INSTALL_ARGS}" --build-arg APCU="${APCU} --build-arg FORCE_YES="${FORCE_YES}" --build_arg APT_REPO="${APT_REPO} --build_arg APT_SECURITY_REPO=${APT_SECURITY_REPO}" .
         docker tag ec-cube2 ghcr.io/ec-cube/ec-cube2-php:${PHP_VERSION_TAG}-apache
         TAG=${PHP_VERSION_TAG}-apache docker-compose up -d
 
diff --git a/Dockerfile b/Dockerfile
index 3c902a30f7..bff7982e1c 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -5,11 +5,21 @@ FROM php:${TAG}
 ARG GD_OPTIONS="--with-freetype --with-jpeg"
 ARG EXT_INSTALL_ARGS="gd zip mysqli pgsql opcache"
 ARG APCU="apcu"
-ARG FORCE_YES="--force-yes"
+ARG FORCE_YES=""
+ARG APT_REPO="deb.debian.org"
+ARG APT_SECURITY_REPO="security.debian.org"
+
 # See https://github.com/debuerreotype/debuerreotype/issues/10
 RUN if [ ! -d /usr/share/man/man1 ]; then mkdir /usr/share/man/man1; fi
 RUN if [ ! -d /usr/share/man/man7 ]; then mkdir /usr/share/man/man7; fi
 
+RUN if [ ! -e /etc/apt/sources.list ]; then touch /etc/apt/sources.list; fi # for bookworm
+RUN sed -i s,deb.debian.org,${APT_REPO},g /etc/apt/sources.list;
+RUN sed -i s,security.debian.org,${APT_SECURITY_REPO},g /etc/apt/sources.list;
+RUN sed -i s,httpredir.debian.org,${APT_REPO},g /etc/apt/sources.list; # for jessie
+RUN sed -i '/stretch-updates/d' /etc/apt/sources.list # for stretch
+RUN sed -i '/jessie-updates/d' /etc/apt/sources.list # for jessie
+
 # ext-gd: libfreetype6-dev libjpeg62-turbo-dev libpng-dev
 # ext-pgsql: libpq-dev
 # ext-zip: libzip-dev zlib1g-dev
@@ -27,7 +37,7 @@ RUN apt-get update \
     && rm -rf /var/lib/apt/lists/*
 
 RUN docker-php-ext-configure gd ${GD_OPTIONS} && docker-php-ext-install ${EXT_INSTALL_ARGS}
-RUN pecl install ${APCU} && docker-php-ext-enable apcu
+RUN if [[ ${APCU} ]]; then  pecl install ${APCU} && docker-php-ext-enable apcu; fi
 
 # composer
 COPY --from=composer:2.2 /usr/bin/composer /usr/bin/composer
@@ -64,4 +74,4 @@ COPY composer.lock ${ECCUBE_PREFIX}/composer.lock
 RUN composer install --no-scripts --no-autoloader --no-dev -d ${ECCUBE_PREFIX}
 
 COPY . ${ECCUBE_PREFIX}
-RUN composer dumpautoload -o --apcu
+RUN composer dumpautoload -o

From 3756041b91f4fc797012c7f4d42eb27662c14ed1 Mon Sep 17 00:00:00 2001
From: Kentaro Ohkouchi <nanasess@fsm.ne.jp>
Date: Sun, 17 Sep 2023 23:57:47 +0900
Subject: [PATCH 2/2] Fix build-arg

---
 .github/workflows/e2e-tests.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml
index 3f15f1646e..a10986636c 100644
--- a/.github/workflows/e2e-tests.yml
+++ b/.github/workflows/e2e-tests.yml
@@ -170,7 +170,7 @@ jobs:
         sudo chown -R 1001:1000 zap
         sudo chmod -R g+w zap
         sh -c 'echo "<?php" >> data/config/config.php'
-        docker build -t ec-cube2 --build-arg PHP_VERSION_TAG="${PHP_VERSION_TAG}" --build-arg GD_OPTIONS="${GD_OPTIONS}" --build-arg EXT_INSTALL_ARGS="${EXT_INSTALL_ARGS}" --build-arg APCU="${APCU} --build-arg FORCE_YES="${FORCE_YES}" --build_arg APT_REPO="${APT_REPO} --build_arg APT_SECURITY_REPO=${APT_SECURITY_REPO}" .
+        docker build -t ec-cube2 --build-arg PHP_VERSION_TAG="${PHP_VERSION_TAG}" --build-arg GD_OPTIONS="${GD_OPTIONS}" --build-arg EXT_INSTALL_ARGS="${EXT_INSTALL_ARGS}" --build-arg APCU="${APCU}" --build-arg FORCE_YES="${FORCE_YES}" --build-arg APT_REPO="${APT_REPO}" --build-arg APT_SECURITY_REPO="${APT_SECURITY_REPO}" .
         docker tag ec-cube2 ghcr.io/ec-cube/ec-cube2-php:${PHP_VERSION_TAG}-apache
         TAG=${PHP_VERSION_TAG}-apache docker-compose up -d