From 667928cfa17f1cbecdc5c9707f22264d70d4fd5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 5 Jun 2025 09:31:50 +0200 Subject: [PATCH 1/9] Add idea settings --- .idea/.gitignore | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .idea/.gitignore diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..7bc07ec --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,10 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Environment-dependent path to Maven home directory +/mavenHomeManager.xml +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml -- 2.47.2 From 723d33e3724bafeffc3ad380b5fbfdac357ba36c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 5 Jun 2025 10:40:06 +0200 Subject: [PATCH 2/9] Add PHP 8.4 base image with build workflow --- .gitea/workflows/build-php-8.4.yaml | 54 ++++++++++++++++++++++ php/8.4/Dockerfile | 71 +++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+) create mode 100644 .gitea/workflows/build-php-8.4.yaml create mode 100644 php/8.4/Dockerfile diff --git a/.gitea/workflows/build-php-8.4.yaml b/.gitea/workflows/build-php-8.4.yaml new file mode 100644 index 0000000..c79e202 --- /dev/null +++ b/.gitea/workflows/build-php-8.4.yaml @@ -0,0 +1,54 @@ +name: Build and Push Chill base image + +on: + push: + workflow_dispatch: + +jobs: + build-and-push: + runs-on: cth-ubuntu-latest + + env: + IMAGE_NAME: chill/base-image + IMAGE_FLAVOR: 8.4 + CONTEXT: php/8.4 + + 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: docker/metadata-action@v5 + with: + images: | + ${{ IMAGE_NAME }} + flavor: | + prefix=${{ env.IMAGE_FLAVOR }} + tags: | + type=schedule + type=edge + + - 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: php/8.4 + file: Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/php/8.4/Dockerfile b/php/8.4/Dockerfile new file mode 100644 index 0000000..917efcc --- /dev/null +++ b/php/8.4/Dockerfile @@ -0,0 +1,71 @@ +FROM php:8.4-fpm-alpine AS chill_base_php82 + +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"] -- 2.47.2 From 5902db1240e38e1ff220916a82357296f7ee7387 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 5 Jun 2025 10:41:07 +0200 Subject: [PATCH 3/9] Update metadata-action URL in PHP 8.4 build workflow --- .gitea/workflows/build-php-8.4.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/build-php-8.4.yaml b/.gitea/workflows/build-php-8.4.yaml index c79e202..bbcbc5b 100644 --- a/.gitea/workflows/build-php-8.4.yaml +++ b/.gitea/workflows/build-php-8.4.yaml @@ -28,7 +28,7 @@ jobs: - name: Docker meta id: meta - uses: docker/metadata-action@v5 + uses: https://github.com/docker/metadata-action@v5 with: images: | ${{ IMAGE_NAME }} -- 2.47.2 From 18f263ee54ed6203fb2645d1f6eec5988360ab38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 5 Jun 2025 10:44:16 +0200 Subject: [PATCH 4/9] Add branch event type to PHP 8.4 build workflow metadata --- .gitea/workflows/build-php-8.4.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitea/workflows/build-php-8.4.yaml b/.gitea/workflows/build-php-8.4.yaml index bbcbc5b..e436750 100644 --- a/.gitea/workflows/build-php-8.4.yaml +++ b/.gitea/workflows/build-php-8.4.yaml @@ -37,6 +37,7 @@ jobs: tags: | type=schedule type=edge + type=ref,event=branch - name: Debug metadata run: | -- 2.47.2 From f6ba5ee207b7da53740b81c827144389ef331ba0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 5 Jun 2025 10:49:18 +0200 Subject: [PATCH 5/9] Refactor PHP 8.4 build workflow to use dynamic build context --- .gitea/workflows/build-php-8.4.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/build-php-8.4.yaml b/.gitea/workflows/build-php-8.4.yaml index e436750..594e2ca 100644 --- a/.gitea/workflows/build-php-8.4.yaml +++ b/.gitea/workflows/build-php-8.4.yaml @@ -48,7 +48,7 @@ jobs: id: build-push uses: https://github.com/docker/build-push-action@v5 with: - context: php/8.4 + context: "{{ defaultContext }}:${{ env.CONTEXT }}" file: Dockerfile push: true tags: ${{ steps.meta.outputs.tags }} -- 2.47.2 From 02cf5dbe4546670aeb63c5eda16d7fb47a7efcfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 5 Jun 2025 10:56:16 +0200 Subject: [PATCH 6/9] Update PHP 8.4 build workflow to fix environment variable usage and enable pull during build --- .gitea/workflows/build-php-8.4.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/build-php-8.4.yaml b/.gitea/workflows/build-php-8.4.yaml index 594e2ca..b3a2d5c 100644 --- a/.gitea/workflows/build-php-8.4.yaml +++ b/.gitea/workflows/build-php-8.4.yaml @@ -31,9 +31,9 @@ jobs: uses: https://github.com/docker/metadata-action@v5 with: images: | - ${{ IMAGE_NAME }} + ${{ env.IMAGE_NAME }} flavor: | - prefix=${{ env.IMAGE_FLAVOR }} + prefix=${{ env.IMAGE_FLAVOR }}- tags: | type=schedule type=edge @@ -50,6 +50,7 @@ jobs: with: context: "{{ defaultContext }}:${{ env.CONTEXT }}" file: Dockerfile + pull: true push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} -- 2.47.2 From ff7b25c608c20849ef14c82f22bf71d128ae70a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 5 Jun 2025 11:03:36 +0200 Subject: [PATCH 7/9] Add cron --- .gitea/workflows/build-php-8.4.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/build-php-8.4.yaml b/.gitea/workflows/build-php-8.4.yaml index b3a2d5c..4f4640a 100644 --- a/.gitea/workflows/build-php-8.4.yaml +++ b/.gitea/workflows/build-php-8.4.yaml @@ -1,6 +1,8 @@ name: Build and Push Chill base image on: + schedule: + - cron: '05 * * * 0' # Runs at 00:00 every Sunday push: workflow_dispatch: @@ -53,4 +55,4 @@ jobs: pull: true push: true tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file -- 2.47.2 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 8/9] 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 -- 2.47.2 From 1958e60469ba7133314330f958bc791ce2fdc8e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 5 Jun 2025 11:16:50 +0200 Subject: [PATCH 9/9] Run cron at different time --- .gitea/workflows/build-php-8.3.yaml | 2 +- .gitea/workflows/build-php-8.4.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/build-php-8.3.yaml b/.gitea/workflows/build-php-8.3.yaml index e436517..0904986 100644 --- a/.gitea/workflows/build-php-8.3.yaml +++ b/.gitea/workflows/build-php-8.3.yaml @@ -2,7 +2,7 @@ name: Build and Push Chill base image on: schedule: - - cron: '13 * * * 0' # Runs at 00:00 every Sunday + - cron: '25 3 * * 1-5' # At 03:25 on every day-of-week from Monday through Friday. push: workflow_dispatch: diff --git a/.gitea/workflows/build-php-8.4.yaml b/.gitea/workflows/build-php-8.4.yaml index 4f4640a..9d605e9 100644 --- a/.gitea/workflows/build-php-8.4.yaml +++ b/.gitea/workflows/build-php-8.4.yaml @@ -2,7 +2,7 @@ name: Build and Push Chill base image on: schedule: - - cron: '05 * * * 0' # Runs at 00:00 every Sunday + - cron: '5 3 * * 1-5' # At 03:05 on every day-of-week from Monday through Friday. push: workflow_dispatch: -- 2.47.2