diff --git a/.gitea/workflows/build-php-8.3.yaml b/.gitea/workflows/build-php-8.3.yaml new file mode 100644 index 0000000..0904986 --- /dev/null +++ b/.gitea/workflows/build-php-8.3.yaml @@ -0,0 +1,58 @@ +name: Build and Push Chill base image + +on: + schedule: + - cron: '25 3 * * 1-5' # At 03:25 on every day-of-week from Monday through Friday. + 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/.gitea/workflows/build-php-8.4.yaml b/.gitea/workflows/build-php-8.4.yaml new file mode 100644 index 0000000..9d605e9 --- /dev/null +++ b/.gitea/workflows/build-php-8.4.yaml @@ -0,0 +1,58 @@ +name: Build and Push Chill base image + +on: + schedule: + - cron: '5 3 * * 1-5' # At 03:05 on every day-of-week from Monday through Friday. + 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: 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/.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 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 new file mode 100644 index 0000000..0efd689 --- /dev/null +++ b/php/8.4/Dockerfile @@ -0,0 +1,71 @@ +FROM php:8.4-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"]