Git Product home page Git Product logo

devgine / composer-php Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 0.0 430 KB

Docker image based on official alpine image, PHP-fpm and composer. This image will help you to build and test your PHP projects with different PHP version. It contains a necessary tools you need to analyse and test your PHP project (xdebug, phpunit, phpstan, psalm, phpcs, php-cs-fixer, phpmd, phpcpd and rector).

License: MIT License

Dockerfile 100.00%
composer docker php phpcpd phpcsfixer phpmd phpstan phpunit rector xdebug

composer-php's Introduction

Composer PHP docker image

Build License GitHub top language Packages retention policy

cover.png

About

This repository is a docker image based on official php, composer and alpine docker images to help you to build and test your PHP projects with different PHP version.
This docker image contains a necessary tools you need to analyze and test your PHP project

  • xdebug
  • phpunit
  • rector
  • phpstan
  • psalm
  • phpcs
  • php-cs-fixer
  • phpmd
  • phpcpd (available from php 7.3 version)

Below is the list of docker images available by PHP versions:

PHP version Docker image tags
PHP 8.3 ghcr.io/devgine/composer-php:latest
PHP 8.2 ghcr.io/devgine/composer-php:v2-php8.2-alpine
PHP 8.1 ghcr.io/devgine/composer-php:v2-php8.1-alpine
PHP 8.0 ghcr.io/devgine/composer-php:v2-php8.0-alpine
PHP 7.4 ghcr.io/devgine/composer-php:v2-php7.4-alpine
PHP 7.3 ghcr.io/devgine/composer-php:v2-php7.3-alpine
PHP 7.2 ghcr.io/devgine/composer-php:v2-php7.2-alpine

Usage

Install from the command line

docker run -ti -v LOCAL_PROJECT_DIR:/var/www/composer ghcr.io/devgine/composer-php:latest sh

All versions

Use as base image in Dockerfile

FROM ghcr.io/devgine/composer-php:latest

# Add your custom instructions here
# example: install bash
RUN apk add --no-cache bash

# example: expose 8080 port
EXPOSE 8080
#...

Use components

Inside the container, you can run any tool you need from any working directory.
Global vendor binaries are added to the PATH environment.

Composer

composer --help

PHP Unit

simple-phpunit --help

Rector

rector --help

PHPStan

phpstan --help

Psalm

psalm --help

PHP Code sniffer

phpcs --help

PHP Coding Standards Fixer

php-cs-fixer --help

PHP Mess Detector

phpmd --help

PHP Copy Past Detector

phpcpd --help

Use image in continuous integration

GitHub action

name: 'Workflow name'
on:
  push
jobs:
  job-id:
    runs-on: ubuntu-latest
    ...
    container:
      image: ghcr.io/devgine/composer-php:latest
    steps:
      - name: 'Run Tests'
        run: simple-phpunit --coverage text
      ...

An example with matrix strategy

name: 'Matrix strategy'
on:
    push
jobs:
  job-id:
    runs-on: ubuntu-latest
    ...
    strategy:
      fail-fast: false
      matrix:
        tag: ['v2-php8.3-alpine', 'v2-php8.2-alpine', 'v2-php8.1-alpine', 'v2-php8.0-alpine', 'v2-php7.4-alpine']
    container:
      image: ghcr.io/devgine/composer-php:${{ matrix.tag }}
    steps:
      - name: 'Run Tests'
        run: simple-phpunit --coverage text
      ...

Gitlab CI

tests:
  image: ghcr.io/devgine/composer-php:latest
  ...
  script:
    - simple-phpunit --coverage text

An example with matrix strategy

tests:
  parallel:
    matrix:
      TAG: ['v2-php8.3-alpine', 'v2-php8.2-alpine', 'v2-php8.1-alpine', 'v2-php8.0-alpine', 'v2-php7.4-alpine']
  image: ghcr.io/devgine/composer-php:${TAG}
  ...
  script:
    - simple-phpunit --coverage text

References

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.