Skip to content

Commit 2cd743f

Browse files
committedMay 10, 2022
Add a Dockerfile for a PHP5.6 dev environment
I didn't have a development setup running PHP5.6 so I put one together in the form of the php56.Dockerfile. Build the dockerfile: `docker build -f php56.Dockerfile -t php-mf2:5.6 .` Run the container and launch bash: `docker run -it --rm php-mf2:5.6 bash` I mostly need this to run the test suite, so I added some scripts into composer.json for phpcs and phpunit w/ code coverage. The container will run the check-and-test-all script automatically if no other script is provided: `docker run -it --rm php-mf2:5.6`
1 parent f30a684 commit 2cd743f

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed
 

‎.dockerignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.Dockerfile
2+
vendor/
3+
composer.lock

‎composer.json

+13
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,19 @@
2424
"dealerdirect/phpcodesniffer-composer-installer": "^0.7",
2525
"phpcompatibility/php-compatibility": "^9.3"
2626
},
27+
"scripts": {
28+
"cs-check": "phpcs",
29+
"tests": "XDEBUG_MODE=coverage ./vendor/bin/phpunit tests --coverage-text --whitelist Mf2",
30+
"test-mf1": "./vendor/bin/phpunit --group microformats/tests/mf1",
31+
"check-and-test": [
32+
"@cs-check",
33+
"@tests"
34+
],
35+
"check-and-test-all": [
36+
"@check-and-test",
37+
"@test-mf1"
38+
]
39+
},
2740
"autoload": {
2841
"files": ["Mf2/Parser.php"]
2942
},

‎php56.Dockerfile

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM php:5.6-cli
2+
3+
COPY --from=composer:2.2.12 /usr/bin/composer /usr/bin/composer
4+
5+
RUN apt-get update && apt-get install -y \
6+
zip \
7+
&& rm -rf /var/cache/apt/
8+
9+
RUN pecl install xdebug-2.5.5 \
10+
&& docker-php-ext-enable xdebug
11+
12+
WORKDIR /usr/share/php-mf2
13+
COPY . .
14+
15+
RUN composer install --prefer-dist --no-cache --no-interaction
16+
17+
CMD ["composer", "--no-interaction", "run", "check-and-test-all"]

0 commit comments

Comments
 (0)
Please sign in to comment.