From 377b28ef576186387565704ed3420c9d9508d58b Mon Sep 17 00:00:00 2001 From: Tuan Pham Date: Tue, 14 Mar 2023 00:04:31 +0700 Subject: [PATCH] build: docker php 8.2 for ci --- .github/workflows/build-docker-php.yml | 41 ++++++++++++++++++++++++++ php/8.2/ci/Dockerfile | 17 +++++++++++ php/8.2/ci/php-ini-overrides.ini | 7 +++++ 3 files changed, 65 insertions(+) create mode 100644 .github/workflows/build-docker-php.yml create mode 100644 php/8.2/ci/Dockerfile create mode 100644 php/8.2/ci/php-ini-overrides.ini diff --git a/.github/workflows/build-docker-php.yml b/.github/workflows/build-docker-php.yml new file mode 100644 index 0000000..aed150e --- /dev/null +++ b/.github/workflows/build-docker-php.yml @@ -0,0 +1,41 @@ +name: Build and publish PHP Docker image + +on: + release: + types: [published] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository_owner }}/php + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: ./php/8.2/ci + push: true + tags: 8.2-ci + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/php/8.2/ci/Dockerfile b/php/8.2/ci/Dockerfile new file mode 100644 index 0000000..f3e8233 --- /dev/null +++ b/php/8.2/ci/Dockerfile @@ -0,0 +1,17 @@ +FROM php:8.2-cli-alpine + +COPY --from=composer:2 /usr/bin/composer /usr/bin/composer + +RUN apk add --no-cache unzip + +ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ +RUN chmod +x /usr/local/bin/install-php-extensions + +# xdebug, pcov are installed, but aren't enabled by default +RUN IPE_DONT_ENABLE=1 install-php-extensions intl gd pdo_mysql pdo_pgsql zip redis-5.3.7 xdebug-3.2.0 pcov-1.0.11 +RUN docker-php-ext-enable redis + +RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" +COPY ./php-ini-overrides.ini "$PHP_INI_DIR/conf.d/99-overrides.ini" + +WORKDIR /app diff --git a/php/8.2/ci/php-ini-overrides.ini b/php/8.2/ci/php-ini-overrides.ini new file mode 100644 index 0000000..0a4294d --- /dev/null +++ b/php/8.2/ci/php-ini-overrides.ini @@ -0,0 +1,7 @@ +memory_limit = 2048M +error_reporting = E_ALL +display_errors = on +display_startup_errors = on +log_errors = on +error_log = /dev/stderr +default_charset = UTF-8 \ No newline at end of file