diff --git a/.readme/images/cover.png b/.readme/images/cover.png new file mode 100644 index 0000000..9f4f3e9 Binary files /dev/null and b/.readme/images/cover.png differ diff --git a/Dockerfile b/Dockerfile index 85b8843..610b10f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG PHP_VERSION=7.2 +ARG PHP_VERSION=8 ARG COMPOSER_VERSION=2 FROM composer:${COMPOSER_VERSION} as composer diff --git a/README.md b/README.md index c2d4111..a0c36c7 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,29 @@ -# Composer PHP golden image +# Composer PHP docker image [![Build](https://github.com/devgine/composer-php/actions/workflows/build.yaml/badge.svg?branch=main)](https://github.com/devgine/composer-php/actions/workflows/build.yaml) [![License](https://img.shields.io/github/license/devgine/composer-php)](https://github.com/devgine/composer-php/blob/main/LICENSE) ![GitHub top language](https://img.shields.io/github/languages/top/devgine/composer-php) [![Packages retention policy](https://github.com/devgine/composer-php/actions/workflows/packages-retention-policy.yaml/badge.svg?branch=main)](https://github.com/devgine/composer-php/actions/workflows/packages-retention-policy.yaml) + +![cover.png](.readme/images/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, phpstan, php-cs-fixer, phpmd, phpcpd and rector).
+This docker image contains a necessary tools you need to analyze and test your PHP project +* xdebug +* phpunit +* phpstan +* psalm +* phpcs +* php-cs-fixer +* phpmd +* phpcpd (available from php 7.3 version) +* rector + Below is the list of docker images available by PHP versions: | PHP version | Docker image tags | |-------------|-------------------------------------------------| -| PHP 8.2 | `ghcr.io/devgine/composer-php:latest` | +| 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` | @@ -18,24 +31,11 @@ Below is the list of docker images available by PHP versions: | PHP 7.3 | `ghcr.io/devgine/composer-php:v2-php7.3-alpine` | | PHP 7.2 | `ghcr.io/devgine/composer-php:v2-php7.2-alpine` | -## Components -All image tags are based on alpine OS.
-Below is the list of tools with their preinstalled version depending on the PHP version. - -| Image tag | PHP | Composer | PHP Unit | XDebug | Rector | PHPStan | PHP CS FIXER | PHP MD | PHP CPD | -|---------------------------------------------|-----|----------|----------|--------|--------|---------|--------------|--------|---------| -| [latest](doc/latest.md) | 8.2 | 2.* | 9.5 | 3.2.1 | 0.16 | 1.10 | 3.17 | 2.13 | 6.0 | -| [v2-php8.2-alpine](doc/v2-php8.2-alpine.md) | 8.2 | 2.* | 9.5 | 3.2.1 | 0.16 | 1.10 | 3.17 | 2.13 | 6.0 | -| [v2-php8.1-alpine](doc/v2-php8.1-alpine.md) | 8.1 | 2.* | 9.5 | 3.2.1 | 0.16 | 1.10 | 3.17 | 2.13 | 6.0 | -| [v2-php8.0-alpine](doc/v2-php8.0-alpine.md) | 8.0 | 2.* | 9.5 | 3.2.1 | 0.16 | 1.10 | 3.17 | 2.13 | 6.0 | -| [v2-php7.4-alpine](doc/v2-php7.4-alpine.md) | 7.4 | 2.* | 8.5 | 3.1.6 | 0.16 | 1.10 | 3.17 | 2.13 | 6.0 | -| [v2-php7.3-alpine](doc/v2-php7.3-alpine.md) | 7.3 | 2.* | 8.5 | 3.1.6 | 0.16 | 1.10 | 3.4 | 2.13 | 6.0 | -| [v2-php7.2-alpine](doc/v2-php7.2-alpine.md) | 7.2 | 2.* | 8.5 | 3.1.6 | 0.16 | 1.10 | 3.4 | 2.13 | -- | ## Usage ### Install from the command line ```shell -docker run -ti -v LOCAL_PROJETC_DIR:/var/www/composer ghcr.io/devgine/composer-php:latest sh +docker run -ti -v LOCAL_PROJECT_DIR:/var/www/composer ghcr.io/devgine/composer-php:latest sh ``` [All versions](https://github.com/devgine/composer-php/pkgs/container/composer-php/versions) ### Use as base image in Dockerfile @@ -54,6 +54,7 @@ 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 ```shell composer --help @@ -70,6 +71,14 @@ rector --help ```shell phpstan --help ``` +#### Psalm +```shell +psalm --help +``` +#### PHP Code sniffer +```shell +phpcs --help +``` #### PHP Coding Standards Fixer ```shell php-cs-fixer --help @@ -113,7 +122,7 @@ jobs: strategy: fail-fast: false matrix: - tag: ['v2-php8.2-alpine', 'v2-php8.1-alpine', 'v2-php8.0-alpine', 'v2-php7.4-alpine'] + 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: @@ -124,7 +133,7 @@ jobs: ### Gitlab CI ```yaml -phpstan: +tests: image: ghcr.io/devgine/composer-php:latest ... script: @@ -133,10 +142,10 @@ phpstan: An example with matrix strategy ```yaml -phpstan: +tests: parallel: matrix: - TAG: ['v2-php8.2-alpine', 'v2-php8.1-alpine', 'v2-php8.0-alpine', 'v2-php7.4-alpine'] + 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: @@ -149,6 +158,8 @@ phpstan: * [PHP Unit](https://symfony.com/doc/current/components/phpunit_bridge.html) * [Rector](https://packagist.org/packages/rector/rector) * [PHPStan](https://phpstan.org/) +* [Psalm](https://psalm.dev/docs/) +* [PHP CS](https://github.com/squizlabs/PHP_CodeSniffer/wiki) * [PHP Coding Standards Fixer](https://cs.symfony.com/) * [PHP Mess Detector](https://phpmd.org/) * [PHP Copy Past detector](https://github.com/sebastianbergmann/phpcpd) diff --git a/doc/latest.md b/doc/latest.md deleted file mode 100644 index fa69524..0000000 --- a/doc/latest.md +++ /dev/null @@ -1,37 +0,0 @@ -# Latest -[Homepage](../README.md) - -## Tag -`ghcr.io/devgine/composer-php:latest` - -## Usage -### Install from the command line -```shell -docker run -ti -v LOCAL_PROJETC_DIR:/var/www/composer ghcr.io/devgine/composer-php:latest sh -``` -[All versions](https://github.com/devgine/composer-php/pkgs/container/composer-php/versions) -### Use as base image in Dockerfile -```dockerfile -FROM ghcr.io/devgine/composer-php:latest - -## SYMFONY CLI INSTALL -RUN apk add --no-cache bash git -RUN curl -1sLf 'https://dl.cloudsmith.io/public/symfony/stable/setup.alpine.sh' | bash -RUN apk add symfony-cli -## END SYMFONY CLI INSTALL -``` - -## Content - -| Component | version | -|----------------------------|---------| -| Alpine | 3.18 | -| PHP | 8.2 | -| Composer | 2.* | -| PHP Unit | 9.5 | -| XDebug | 3.2.1 | -| Rector | 0.16 | -| PHPStan | 1.10 | -| PHP Coding Standards Fixer | 3.17 | -| PHP Mess Detector | 2.13 | -| PHP Copy Past Detector | 6.0 | diff --git a/doc/v2-php7.2-alpine.md b/doc/v2-php7.2-alpine.md deleted file mode 100644 index 1410dda..0000000 --- a/doc/v2-php7.2-alpine.md +++ /dev/null @@ -1,38 +0,0 @@ -# v2-php7.2-alpine -[Homepage](../README.md) - -## Tag -`ghcr.io/devgine/composer-php:v2-php7.2-alpine` - -## Usage - -### Install from the command line -```shell -docker run -ti -v LOCAL_PROJETC_DIR:/var/www/composer ghcr.io/devgine/composer-php:v2-php7.2-alpine sh -``` -[All versions](https://github.com/devgine/composer-php/pkgs/container/composer-php/versions) - -### Use as base image in Dockerfile -```dockerfile -FROM ghcr.io/devgine/composer-php:v2-php7.2-alpine - -# Add your custom instructions here -# example: install symfony cli -RUN apk add --no-cache bash git -RUN curl -1sLf 'https://dl.cloudsmith.io/public/symfony/stable/setup.alpine.sh' | bash -RUN apk add symfony-cli -``` - -## Content - -| Component | version | -|----------------------------|---------| -| Alpine | 3.12 | -| PHP | 7.2 | -| Composer | 2.* | -| PHP Unit | 9.5 | -| XDebug | 3.1.6 | -| Rector | 0.16 | -| PHPStan | 1.10 | -| PHP Coding Standards Fixer | 3.4 | -| PHP Mess Detector | 2.13 | diff --git a/doc/v2-php7.3-alpine.md b/doc/v2-php7.3-alpine.md deleted file mode 100644 index b129d87..0000000 --- a/doc/v2-php7.3-alpine.md +++ /dev/null @@ -1,39 +0,0 @@ -# v2-php7.3-alpine -[Homepage](../README.md) - -## Tag -`ghcr.io/devgine/composer-php:v2-php7.3-alpine` - -## Usage - -### Install from the command line -```shell -docker run -ti -v LOCAL_PROJETC_DIR:/var/www/composer ghcr.io/devgine/composer-php:v2-php7.3-alpine sh -``` -[All versions](https://github.com/devgine/composer-php/pkgs/container/composer-php/versions) - -### Use as base image in Dockerfile -```dockerfile -FROM ghcr.io/devgine/composer-php:v2-php7.3-alpine - -# Add your custom instructions here -# example: install symfony cli -RUN apk add --no-cache bash git -RUN curl -1sLf 'https://dl.cloudsmith.io/public/symfony/stable/setup.alpine.sh' | bash -RUN apk add symfony-cli -``` - -## Content - -| Component | version | -|----------------------------|---------| -| Alpine | 3.15 | -| PHP | 7.3 | -| Composer | 2.* | -| PHP Unit | 9.5 | -| XDebug | 3.1.6 | -| Rector | 0.16 | -| PHPStan | 1.10 | -| PHP Coding Standards Fixer | 3.4 | -| PHP Mess Detector | 2.13 | -| PHP Copy Past Detector | 6.0 | diff --git a/doc/v2-php7.4-alpine.md b/doc/v2-php7.4-alpine.md deleted file mode 100644 index 637096a..0000000 --- a/doc/v2-php7.4-alpine.md +++ /dev/null @@ -1,39 +0,0 @@ -# v2-php7.4-alpine -[Homepage](../README.md) - -## Tag -`ghcr.io/devgine/composer-php:v2-php7.4-alpine` - -## Usage - -### Install from the command line -```shell -docker run -ti -v LOCAL_PROJETC_DIR:/var/www/composer ghcr.io/devgine/composer-php:v2-php7.4-alpine sh -``` -[All versions](https://github.com/devgine/composer-php/pkgs/container/composer-php/versions) - -### Use as base image in Dockerfile -```dockerfile -FROM ghcr.io/devgine/composer-php:v2-php7.4-alpine - -# Add your custom instructions here -# example: install symfony cli -RUN apk add --no-cache bash git -RUN curl -1sLf 'https://dl.cloudsmith.io/public/symfony/stable/setup.alpine.sh' | bash -RUN apk add symfony-cli -``` - -## Content - -| Component | version | -|----------------------------|---------| -| Alpine | 3.16 | -| PHP | 7.4 | -| Composer | 2.* | -| PHP Unit | 9.5 | -| XDebug | 3.1.6 | -| Rector | 0.16 | -| PHPStan | 1.10 | -| PHP Coding Standards Fixer | 3.17 | -| PHP Mess Detector | 2.13 | -| PHP Copy Past Detector | 6.0 | diff --git a/doc/v2-php8.0-alpine.md b/doc/v2-php8.0-alpine.md deleted file mode 100644 index 29abe9e..0000000 --- a/doc/v2-php8.0-alpine.md +++ /dev/null @@ -1,39 +0,0 @@ -# v2-php8.0-alpine -[Homepage](../README.md) - -## Tag -`ghcr.io/devgine/composer-php:v2-php8.0-alpine` - -## Usage - -### Install from the command line -```shell -docker run -ti -v LOCAL_PROJETC_DIR:/var/www/composer ghcr.io/devgine/composer-php:v2-php8.0-alpine sh -``` -[All versions](https://github.com/devgine/composer-php/pkgs/container/composer-php/versions) - -### Use as base image in Dockerfile -```dockerfile -FROM ghcr.io/devgine/composer-php:v2-php8.0-alpine - -# Add your custom instructions here -# example: install symfony cli -RUN apk add --no-cache bash git -RUN curl -1sLf 'https://dl.cloudsmith.io/public/symfony/stable/setup.alpine.sh' | bash -RUN apk add symfony-cli -``` - -## Content - -| Component | version | -|----------------------------|---------| -| Alpine | 3.16 | -| PHP | 8.0 | -| Composer | 2.* | -| PHP Unit | 9.5 | -| XDebug | 3.2.1 | -| Rector | 0.16 | -| PHPStan | 1.10 | -| PHP Coding Standards Fixer | 3.17 | -| PHP Mess Detector | 2.13 | -| PHP Copy Past Detector | 6.0 | diff --git a/doc/v2-php8.1-alpine.md b/doc/v2-php8.1-alpine.md deleted file mode 100644 index 68e9a24..0000000 --- a/doc/v2-php8.1-alpine.md +++ /dev/null @@ -1,39 +0,0 @@ -# v2-php8.1-alpine -[Homepage](../README.md) - -## Tag -`ghcr.io/devgine/composer-php:v2-php8.1-alpine` - -## Usage - -### Install from the command line -```shell -docker run -ti -v LOCAL_PROJETC_DIR:/var/www/composer ghcr.io/devgine/composer-php:v2-php8.1-alpine sh -``` -[All versions](https://github.com/devgine/composer-php/pkgs/container/composer-php/versions) - -### Use as base image in Dockerfile -```dockerfile -FROM ghcr.io/devgine/composer-php:v2-php8.1-alpine - -# Add your custom instructions here -# example: install symfony cli -RUN apk add --no-cache bash git -RUN curl -1sLf 'https://dl.cloudsmith.io/public/symfony/stable/setup.alpine.sh' | bash -RUN apk add symfony-cli -``` - -## Content - -| Component | version | -|----------------------------|---------| -| Alpine | 3.18 | -| PHP | 8.1 | -| Composer | 2.* | -| PHP Unit | 9.5 | -| XDebug | 3.2.1 | -| Rector | 0.16 | -| PHPStan | 1.10 | -| PHP Coding Standards Fixer | 3.17 | -| PHP Mess Detector | 2.13 | -| PHP Copy Past Detector | 6.0 | diff --git a/doc/v2-php8.2-alpine.md b/doc/v2-php8.2-alpine.md deleted file mode 100644 index e29f359..0000000 --- a/doc/v2-php8.2-alpine.md +++ /dev/null @@ -1,39 +0,0 @@ -# v2-php8.2-alpine -[Homepage](../README.md) - -## Tag -`ghcr.io/devgine/composer-php:v2-php8.2-alpine` - -## Usage - -### Install from the command line -```shell -docker run -ti -v LOCAL_PROJETC_DIR:/var/www/composer ghcr.io/devgine/composer-php:v2-php8.2-alpine sh -``` -[All versions](https://github.com/devgine/composer-php/pkgs/container/composer-php/versions) - -### Use as base image in Dockerfile -```dockerfile -FROM ghcr.io/devgine/composer-php:v2-php8.2-alpine - -# Add your custom instructions here -# example: install symfony cli -RUN apk add --no-cache bash git -RUN curl -1sLf 'https://dl.cloudsmith.io/public/symfony/stable/setup.alpine.sh' | bash -RUN apk add symfony-cli -``` - -## Content - -| Component | version | -|----------------------------|---------| -| Alpine | 3.18 | -| PHP | 8.2 | -| Composer | 2.* | -| PHP Unit | 9.5 | -| XDebug | 3.2.1 | -| Rector | 0.16 | -| PHPStan | 1.10 | -| PHP Coding Standards Fixer | 3.17 | -| PHP Mess Detector | 2.13 | -| PHP Copy Past Detector | 6.0 |