From 6dd42dc434045cc0e347741ee268dd0da29de91c Mon Sep 17 00:00:00 2001 From: Muhamad Aditya Prima Date: Mon, 16 Dec 2024 19:58:23 +0700 Subject: [PATCH] Added database connector support: mysql and postgresql --- .gitea/workflows/php5.yaml | 21 +++++++++++++++++++-- 5/scripts/alpine-setup.sh | 8 ++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/php5.yaml b/.gitea/workflows/php5.yaml index 4cd458c..d5993f3 100644 --- a/.gitea/workflows/php5.yaml +++ b/.gitea/workflows/php5.yaml @@ -14,6 +14,7 @@ jobs: strategy: matrix: server: ["blank", "apache"] + database: ["blank", "mysql", "postgresql"] flavors: ["cli", "full", "debug"] version: - os: "alpine" @@ -33,7 +34,7 @@ jobs: # uses: docker/setup-qemu-action@v3 - name: Setup Docker buildx uses: docker/setup-buildx-action@v3 - - if: ${{ matrix.server == 'blank' }} + - if: ${{ matrix.server == 'blank' && matrix.database == 'blank' }} name: Build and push php5 uses: docker/build-push-action@v5 with: @@ -47,7 +48,7 @@ jobs: PHP_VER_SHORT=${{ matrix.version.php_ver_short }} tags: | quay.io/sindigilive/php:${{ matrix.version.php_version }}-${{ matrix.flavors }}-${{ matrix.version.os }} - - if: ${{ matrix.server == 'apache' }} + - if: ${{ matrix.server == 'apache' && matrix.database == 'blank' }} name: Build and push php5 with apache2 uses: docker/build-push-action@v5 with: @@ -62,6 +63,22 @@ jobs: WITH_APACHE=true tags: | quay.io/sindigilive/php:${{ matrix.version.php_version }}-${{ matrix.flavors }}-${{ matrix.server }}-${{ matrix.version.os }} + - if: ${{ matrix.server == 'apache' && matrix.database != 'blank' && matrix.flavors != 'cli' }} + name: Build and push php5 with apache2 and database connector library + uses: docker/build-push-action@v5 + with: + push: true + context: . + file: 5/Dockerfile.${{ matrix.server }}-${{ matrix.version.os }} + build-args: | + OS_VERSION=${{ matrix.version.os_version }} + FLAVOR=${{ matrix.flavors }} + PHP_VERSION=${{ matrix.version.php_version }} + PHP_VER_SHORT=${{ matrix.version.php_ver_short }} + WITH_APACHE=true + WITH_DATABASE=${{ matrix.database }} + tags: | + quay.io/sindigilive/php:${{ matrix.version.php_version }}-${{ matrix.flavors }}-${{ matrix.server }}-${{ matrix.database }}-${{ matrix.version.os }} # build-latest: # name: Build latest nginx alpine based container images # runs-on: ubuntu-latest diff --git a/5/scripts/alpine-setup.sh b/5/scripts/alpine-setup.sh index 3029f49..afa0376 100644 --- a/5/scripts/alpine-setup.sh +++ b/5/scripts/alpine-setup.sh @@ -55,4 +55,12 @@ if [ "$WITH_APACHE" == "true" ]; then sed -i "s|Require ip 127|Require all granted|" /etc/apache2/conf.d/info.conf ; sed -i "s|/run/apache2/httpd.pid|${SERVER_ROOT}/run/httpd.pid|" /etc/apache2/conf.d/mpm.conf ; fi +fi + +if ["$WITH_DATABASE" == "postgresql"]; then + /sbin/apk add --update --no-cache php$PHP_VER_SHORT-pdo php$PHP_VER_SHORT-pdo_pgsql php$PHP_VER_SHORT-pgsql ; +fi + +if ["$WITH_DATABASE" == "mysql"]; then + /sbin/apk add --update --no-cache php$PHP_VER_SHORT-pdo php$PHP_VER_SHORT-pdo_mysql php$PHP_VER_SHORT-mysql php$PHP_VER_SHORT-mysqli ; fi \ No newline at end of file