From ad33a24c14ed6e83264455c357b989e8e88d487a Mon Sep 17 00:00:00 2001 From: Pascal Sthamer <10992664+P4sca1@users.noreply.github.com> Date: Mon, 18 Nov 2024 17:37:26 +0100 Subject: [PATCH] upgrade to php 8.3, add pipeline to build image, update php extensions Signed-off-by: Pascal Sthamer <10992664+P4sca1@users.noreply.github.com> --- .github/workflows/build.yml | 40 +++++++++++++++++++++++++++++++++++++ Dockerfile | 29 ++++++--------------------- 2 files changed, 46 insertions(+), 23 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..273790a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,40 @@ +name: "Build php-fpm image" + +on: + schedule: + - cron: 0 0 * * 0 + + push: + branches: + - main + +env: + PHP_VERSION: "8.3" + +jobs: + build-and-deploy: + name: Build and push Docker image + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v6 + with: + push: true + build-args: | + PHP_VERSION={{ env.PHP_VERSION }} + tags: >- + ghcr.io/Einfach-Gaming/php-fpm:{{ env.PHP_VERSION }} + diff --git a/Dockerfile b/Dockerfile index fbc3e9d..2ee26b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,26 +1,9 @@ -FROM php:7.4-fpm-alpine +ARG PHP_VERSION=8.1 -# Install required packages. -RUN apk add --update --no-cache \ - freetype-dev \ - libjpeg-turbo-dev \ - libpng-dev \ - libzip-dev \ - autoconf \ - g++ \ - make +FROM php:${PHP_VERSION}-fpm -# Configure gd to support jpeg. -RUN docker-php-ext-configure gd --with-jpeg +ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ -# Install PHP extensions. -RUN docker-php-ext-install pdo_mysql gd bcmath mysqli zip exif - -# Install PHP Redis. -RUN docker-php-source extract && \ - pecl install redis && \ - docker-php-ext-enable redis && \ - docker-php-source delete - -# Remove packages only required for building. -RUN apk del g++ make +# Install required PHP extensions +# https://manual.woltlab.com/en/requirements/ +RUN install-php-extensions ctype dom exif gmp intl libxml mbstring openssl pdo pdo_mysql zlib imagick