Skip to content

Commit bea5c31

Browse files
authored
Merge pull request #5 from thiagobraga/feature/add-image-tag-8.0
feat: add tag 8.0 for phpqa image
2 parents a706d6f + 6be9dd8 commit bea5c31

File tree

7 files changed

+79
-21
lines changed

7 files changed

+79
-21
lines changed

7.4/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@ RUN sed -i 's/\(^export PATH=.*\)/\1:\/root\/.composer\/vendor\/bin:\/phars/' /e
77
RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS \
88
&& pecl install ast \
99
&& echo 'extension=ast.so' >> /usr/local/etc/php/php.ini \
10+
&& docker-php-ext-enable xdebug \
1011
&& apk del .build-deps \
1112
&& rm -rf /var/cache/apk/* /tmp/*
1213

1314
# install QA tools
1415
RUN \
1516
# install and set up QA tools from Composer
16-
composer global require friendsofphp/php-cs-fixer phan/phan \
17+
composer global require squizlabs/php_codesniffer \
18+
friendsofphp/php-cs-fixer \
19+
phan/phan \
1720
# download PHAR and make them executable
1821
&& mkdir /phars \
1922
&& curl -Lf https://phpmd.org/static/latest/phpmd.phar -o /phars/phpmd \

8.0/Dockerfile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
FROM kooldev/php:8.0
2+
3+
# make Composer global vendor/bin available through PATH
4+
RUN sed -i 's/\(^export PATH=.*\)/\1:\/root\/.composer\/vendor\/bin:\/phars/' /etc/profile
5+
6+
# install dependencies (ast)
7+
RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS \
8+
&& pecl install ast \
9+
&& echo 'extension=ast.so' >> /usr/local/etc/php/php.ini \
10+
&& docker-php-ext-enable xdebug \
11+
&& apk del .build-deps \
12+
&& rm -rf /var/cache/apk/* /tmp/*
13+
14+
# install QA tools
15+
RUN \
16+
# install and set up QA tools from Composer
17+
composer global require squizlabs/php_codesniffer \
18+
friendsofphp/php-cs-fixer \
19+
phan/phan \
20+
# download PHAR and make them executable
21+
&& mkdir /phars \
22+
&& curl -Lf https://phpmd.org/static/latest/phpmd.phar -o /phars/phpmd \
23+
&& curl -Lf https://github.com/fabpot/local-php-security-checker/releases/download/v1.0.0/local-php-security-checker_1.0.0_linux_amd64 -o /phars/local-php-security-checker \
24+
&& curl -Lf https://phar.phpunit.de/phpcpd.phar -o /phars/phpcpd \
25+
&& curl -Lf https://phar.phpunit.de/phpunit-nightly.phar -o /phars/phpunit10 \
26+
&& curl -Lf https://phar.phpunit.de/phpunit-9.5.phar -o /phars/phpunit \
27+
&& chmod +x /phars/* \
28+
# post-install tools settings
29+
&& /phars/local-php-security-checker --update-cache
30+
31+
ADD entrypoint.sh /kool/entrypoint.sh
32+
RUN chmod +x /kool/entrypoint.sh
33+
34+
ENTRYPOINT [ "/kool/entrypoint.sh" ]
35+
CMD [ "composer", "--version" ]

8.0/entrypoint.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
source /etc/profile
4+
5+
exec "$@"

README.md

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@
22

33
## Description
44

5-
Minimal PHP QA Docker image focused on loca/CI static analysis, styling and other tools.
5+
Minimal PHP QA Docker image focused on local/CI static analysis, styling and other tools.
66

77
It's plays nicely with [kool.dev](https://github.com/kool-dev/kool) managed environments, but can fit in any other PHP use-case.
88

9-
#### Tools included in the image
9+
### Tools included in the image
1010

11-
**Static analysis**
11+
#### Static analysis
1212

1313
- Phan - static analyzer for PHP (`phan`)
1414
- PHP Mess Detector (`phpmd`)
1515
- PHP Copy/Paste Detector (`phpcpd`)
1616

17-
**Code Style**
17+
#### Code Style
1818

1919
- PHP Coding Standards Fixer (`php-cs-fixer`)
2020

21-
**Security**
21+
#### Security
2222

2323
- Local PHP Security Checker (`local-php-security-checker`)
2424

25-
**Testing**
25+
#### Testing
2626

2727
- PHPUnit 9.5 (`phpunit`)
2828
- PHPUnit 10 (`phpunit10` for cutting-edge testing)
@@ -31,16 +31,16 @@ It's plays nicely with [kool.dev](https://github.com/kool-dev/kool) managed envi
3131

3232
Just execute any QA tool available straight from a new container. Using [`kool`](https://github.com/kool-dev/kool) is the prefered way:
3333

34-
```console
35-
$ cd my-laravel-project/
36-
$ kool docker kooldev/phpqa:7.4 phan
37-
$ kool docker kooldev/phpqa:7.4 php-cs-fixer
34+
```sh
35+
cd my-laravel-project/
36+
kool docker kooldev/phpqa:7.4 phan
37+
kool docker kooldev/phpqa:7.4 php-cs-fixer
3838
```
3939

4040
With vanilla Docker you would need to run:
4141

42-
```
43-
$ docker run --rm --init -it -v $(pwd):/app -w /app kooldev/phpqa:7.4
42+
```sh
43+
docker run --rm --init -it -v $(pwd):/app -w /app kooldev/phpqa:7.4
4444
```
4545

4646
> We strongly recommend checking out [`kool` CLI](https://github.com/kool-dev/kool) for more benefits to your Docker environemnts.
@@ -49,19 +49,18 @@ $ docker run --rm --init -it -v $(pwd):/app -w /app kooldev/phpqa:7.4
4949

5050
The image built is [`kooldev/phpqa`](https://hub.docker.com/r/kooldev/phpqa/tags?page=1&ordering=last_updated) with tags:
5151

52-
### 7.4
53-
54-
- [7.4](https://github.com/kool-dev/docker-phpqa/blob/main/7.4/Dockerfile)
52+
- [**`7.4`**](https://github.com/kool-dev/docker-phpqa/blob/main/7.4/Dockerfile)
53+
- [**`8.0`**](https://github.com/kool-dev/docker-phpqa/blob/main/8.0/Dockerfile)
5554

56-
## Using kool.yml
55+
## Using `kool.yml`
5756

5857
Examples of what you can do in a `kool` powered environment. Add to your `kool.yml` file:
5958

6059
```yaml
6160
# kool.yml
6261
scripts:
6362
# just an alias to the PHPQA container
64-
phpqa: kool docker kooldev/phpqa:7.4
63+
phpqa: kool docker kooldev/phpqa:8.0
6564
# using the alias to call each tool with predefined parameters
6665
# assuming your application code is located in a `app/` folder
6766
phan: kool run phpqa phan --color -p -l app -iy 5
@@ -77,7 +76,6 @@ Please feel free to use and open a PR with more QA tools you find useful to have
7776
- Ship boilerplate of CI snippets for popular engines (Github Actions, CircleCI, TravisCI).
7877
- Add more tools that we find helpful.
7978

80-
8179
### Update images with templates
8280

8381
You should change `fwd-template.json` for configuration and `template/` folder for the actual base templates.

fwd-template.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,21 @@
1515
"path": "template/entrypoint"
1616
}
1717
]
18+
},
19+
{
20+
"name": "8.0",
21+
"data": {
22+
"from": "kooldev/php:8.0"
23+
},
24+
"files": [
25+
{
26+
"name": "Dockerfile",
27+
"path": "template/Dockerfile"
28+
}, {
29+
"name": "entrypoint.sh",
30+
"path": "template/entrypoint"
31+
}
32+
]
1833
}
1934
]
2035
}

kool.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ scripts:
66
# PHP 7.4
77
- docker build --pull -t kooldev/phpqa:7.4 7.4
88
# PHP 8.0
9-
# - docker build --pull -t kooldev/phpqa:8.0 8.0
9+
- docker build --pull -t kooldev/phpqa:8.0 8.0

template/Dockerfile.blade.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
# install QA tools
1515
RUN \
1616
# install and set up QA tools from Composer
17-
composer global require friendsofphp/php-cs-fixer phan/phan \
17+
composer global require squizlabs/php_codesniffer \
18+
friendsofphp/php-cs-fixer \
19+
phan/phan \
1820
# download PHAR and make them executable
1921
&& mkdir /phars \
2022
&& curl -Lf https://phpmd.org/static/latest/phpmd.phar -o /phars/phpmd \

0 commit comments

Comments
 (0)