From daab314354221236ef0a57dad4f9f2ddb05937d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 5 Jun 2025 11:09:57 +0200 Subject: [PATCH] add 8.3 build image --- .gitea/workflows/build-php-8.3.yaml | 58 +++++++++++++++++++++++ php/8.3/Dockerfile | 71 +++++++++++++++++++++++++++++ php/8.4/Dockerfile | 2 +- 3 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 .gitea/workflows/build-php-8.3.yaml create mode 100644 php/8.3/Dockerfile diff --git a/.gitea/workflows/build-php-8.3.yaml b/.gitea/workflows/build-php-8.3.yaml new file mode 100644 index 0000000..e436517 --- /dev/null +++ b/.gitea/workflows/build-php-8.3.yaml @@ -0,0 +1,58 @@ +name: Build and Push Chill base image + +on: + schedule: + - cron: '13 * * * 0' # Runs at 00:00 every Sunday + push: + workflow_dispatch: + +jobs: + build-and-push: + runs-on: cth-ubuntu-latest + + env: + IMAGE_NAME: chill/base-image + IMAGE_FLAVOR: 8.3 + CONTEXT: php/8.3 + + steps: + - name: Checkout code + uses: https://github.com/actions/checkout@v4 + + - name: Set up Docker Buildx + uses: https://github.com/docker/setup-buildx-action@v3 + + - name: Log in to Docker hub + uses: https://github.com/docker/login-action@v3 + with: + username: ${{ vars.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} + + - name: Docker meta + id: meta + uses: https://github.com/docker/metadata-action@v5 + with: + images: | + ${{ env.IMAGE_NAME }} + flavor: | + prefix=${{ env.IMAGE_FLAVOR }}- + tags: | + type=schedule + type=edge + type=ref,event=branch + + - name: Debug metadata + run: | + echo "Tags: ${{ steps.meta.outputs.tags }}" + echo "Labels: ${{ steps.meta.outputs.labels }}" + + - name: Build and push + id: build-push + uses: https://github.com/docker/build-push-action@v5 + with: + context: "{{ defaultContext }}:${{ env.CONTEXT }}" + file: Dockerfile + pull: true + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/php/8.3/Dockerfile b/php/8.3/Dockerfile new file mode 100644 index 0000000..f02f6d6 --- /dev/null +++ b/php/8.3/Dockerfile @@ -0,0 +1,71 @@ +FROM php:8.3-fpm-alpine + +ENV POSTGRES_VERSION=17 + +# default UID for the PHP user +ARG UID=1000 +ARG GID=1000 + +# install php extensions and deps +# apk add --no-cache --update --virtual rabbitmq-c-dev rabbitmq-c-utils gcc g++ make autoconf && pecl install amqp +RUN apk update && apk add --no-cache \ + wget gnupg \ + libpq-dev \ + icu-dev icu-libs icu-data-full \ + oniguruma-dev \ + libzip libzip-dev \ + linux-headers \ + gcc g++ make autoconf \ + bash git \ + rabbitmq-c rabbitmq-c-dev \ + libpng-dev libjpeg-turbo-dev freetype-dev \ + postgresql${POSTGRES_VERSION}-client \ + && docker-php-ext-install pdo_pgsql intl mbstring zip bcmath exif sockets \ + && git clone https://github.com/nikic/php-ast.git \ + && cd php-ast \ + && phpize \ + && ./configure \ + && make install \ + && echo 'extension=ast.so' > /usr/local/etc/php/php.ini \ + && cd .. && rm -rf php-ast \ + && pecl install redis \ + && docker-php-ext-enable redis \ + && pecl install amqp \ + && docker-php-ext-enable amqp \ + && docker-php-ext-configure gd --with-freetype --with-jpeg \ + && docker-php-ext-install -j$(nproc) gd \ + && apk del --purge wget gnupg libpq-dev icu-dev oniguruma-dev libzip-dev linux-headers gcc g++ make autoconf + +RUN { \ + echo ""; \ + echo "memory_limit = 512M"; \ + echo ""; \ + } >> /usr/local/etc/php/conf.d/memory_limit.ini + +RUN { \ + echo ""; \ + echo "[Date]"; \ + echo "date.timezone = Europe/Brussels"; \ + echo ""; \ + } >> /usr/local/etc/php/conf.d/date.ini + +RUN curl -o /usr/local/bin/php-cs-fixer https://cs.symfony.com/download/php-cs-fixer-v3.phar \ + && chmod +x /usr/local/bin/php-cs-fixer +# to make php-cs-fixer works with earlier version of php +ENV PHP_CS_FIXER_IGNORE_ENV=1 + +COPY --from=composer:2 /usr/bin/composer /usr/bin/composer +ENV COMPOSER_ALLOW_SUPERUSER=1 +ENV COMPOSER_MEMORY_LIMIT=-1 + +# shell bash preference +RUN sed -i " \ + s|root:x:0:0:root:/root:/bin/ash|root:x:0:0:root:/root:/bin/bash|g;" \ + /etc/passwd + +# chmod on redis.so +RUN chmod 755 -R /usr/local/lib/php/extensions/ + +WORKDIR /var/www/app + +CMD ["php-fpm"] diff --git a/php/8.4/Dockerfile b/php/8.4/Dockerfile index 917efcc..0efd689 100644 --- a/php/8.4/Dockerfile +++ b/php/8.4/Dockerfile @@ -1,4 +1,4 @@ -FROM php:8.4-fpm-alpine AS chill_base_php82 +FROM php:8.4-fpm-alpine ENV POSTGRES_VERSION=17