From 6e7e009baccb125262214b50f06e8c820cd5bbdc Mon Sep 17 00:00:00 2001 From: Andrea Giannantonio Date: Tue, 3 Oct 2023 16:49:53 +0200 Subject: [PATCH] chore: add workflows pipeline for php 8.1 and 8.2 --- .docker/base/php81/Dockerfile | 17 +++++++++++++++++ .docker/base/php82/Dockerfile | 17 +++++++++++++++++ .docker/development/php81/Dockerfile | 5 +++++ .docker/development/php82/Dockerfile | 5 +++++ .github/workflows/php.yml | 10 ++++++---- CONTRIBUTING.md | 5 +++++ docker-compose.yml | 16 ++++++++++++++++ 7 files changed, 71 insertions(+), 4 deletions(-) create mode 100644 .docker/base/php81/Dockerfile create mode 100644 .docker/base/php82/Dockerfile create mode 100644 .docker/development/php81/Dockerfile create mode 100644 .docker/development/php82/Dockerfile diff --git a/.docker/base/php81/Dockerfile b/.docker/base/php81/Dockerfile new file mode 100644 index 0000000..a109b3d --- /dev/null +++ b/.docker/base/php81/Dockerfile @@ -0,0 +1,17 @@ +FROM php:8.1-fpm + +USER root + +# install system packages +RUN apt-get update \ + && apt-get -y install git wget \ + && apt-get install -qqy libzip-dev libpng-dev libjpeg-dev libfreetype6-dev \ + && apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* + +# configure php packages +RUN docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ + +# install php requirements +RUN docker-php-ext-install zip iconv gd + +COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer diff --git a/.docker/base/php82/Dockerfile b/.docker/base/php82/Dockerfile new file mode 100644 index 0000000..daa1a6b --- /dev/null +++ b/.docker/base/php82/Dockerfile @@ -0,0 +1,17 @@ +FROM php:8.2-fpm + +USER root + +# install system packages +RUN apt-get update \ + && apt-get -y install git wget \ + && apt-get install -qqy libzip-dev libpng-dev libjpeg-dev libfreetype6-dev \ + && apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* + +# configure php packages +RUN docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ + +# install php requirements +RUN docker-php-ext-install zip iconv gd + +COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer diff --git a/.docker/development/php81/Dockerfile b/.docker/development/php81/Dockerfile new file mode 100644 index 0000000..e0b7efa --- /dev/null +++ b/.docker/development/php81/Dockerfile @@ -0,0 +1,5 @@ +FROM pugx/poser:php81 + +USER root + +WORKDIR "/application" diff --git a/.docker/development/php82/Dockerfile b/.docker/development/php82/Dockerfile new file mode 100644 index 0000000..cdd85a4 --- /dev/null +++ b/.docker/development/php82/Dockerfile @@ -0,0 +1,5 @@ +FROM pugx/poser:php82 + +USER root + +WORKDIR "/application" diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 4d156bc..8b3c174 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -2,7 +2,9 @@ name: Build on: push: + branches: [ "master" ] pull_request: + branches: [ "master" ] jobs: cs-fix: @@ -10,7 +12,7 @@ jobs: name: PHP-CS-Fixer steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Fix CS uses: docker://oskarstark/php-cs-fixer-ga @@ -18,19 +20,19 @@ jobs: strategy: matrix: - container: [ "php74", "php80" ] + container: [ "php74", "php80", "php81", "php82" ] runs-on: ubuntu-latest container: pugx/poser:${{ matrix.container }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Validate composer.json run: composer validate - name: Cache Composer packages id: composer-cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: vendor key: ${{ runner.os }}-php-${{ matrix.container }}-${{ hashFiles('**/composer.lock') }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8445b52..5916474 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -55,5 +55,10 @@ $ composer phpspec $ composer behat ``` +## How build new images +```shell +$ docker build -t pugx/poser:php81 -f .docker/base/php81/Dockerfile . +$ docker push pugx/poser:php81 +``` ## ENJOY diff --git a/docker-compose.yml b/docker-compose.yml index 561127d..cd27901 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,3 +16,19 @@ services: stdin_open: true volumes: - .:/application:cached + + php81: + build: + context: .docker/development/php81 + working_dir: /application + stdin_open: true + volumes: + - .:/application:cached + + php82: + build: + context: .docker/development/php82 + working_dir: /application + stdin_open: true + volumes: + - .:/application:cached