Add PHP 8.4 base image with build workflow
Some checks failed
Build and Push Chill base image / build-and-push (push) Failing after 6s

This commit is contained in:
Julien Fastré 2025-06-05 10:40:06 +02:00
parent 667928cfa1
commit 723d33e372
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
2 changed files with 125 additions and 0 deletions

View File

@ -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 }}

71
php/8.4/Dockerfile Normal file
View File

@ -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"]