Skip to content

Commit

Permalink
build: docker php 8.2 for ci
Browse files Browse the repository at this point in the history
  • Loading branch information
tuanpt-0634 committed Mar 13, 2023
1 parent 32d1b42 commit 377b28e
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/build-docker-php.yml
Original file line number Diff line number Diff line change
@@ -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 }}
17 changes: 17 additions & 0 deletions php/8.2/ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions php/8.2/ci/php-ini-overrides.ini
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 377b28e

Please sign in to comment.