Open ferronsw opened 1 year ago
See https://github.com/yiisoft/yii2-docker#faq
If you can come up with a PR where all (basic) framework tests pass we might reconsider it. We had very esoteric issues with timezone, AFAIR.
Related:
Okay, I can give it a try. Any specific package Yii depends on for timezones?
php-intl was a problem, see also https://github.com/yiisoft/yii2-docker/issues/25
docker-compose run --rm php php /tests/requirements.php
doesn't work.
docker-compose run --rm php php /tests/requirements.php
WARN[0000] The "GITHUB_API_TOKEN" variable is not set. Defaulting to a blank string.
no such service: php
php-min works, but then you get:
/usr/local/bin/docker-php-entrypoint: exec: line 20: ph-minp: not found
@ferronsw Did you recreate the Alpine flavor on a fork of yours? Where can I find it?
ph-minp: not found
looks like a typo?!
Yes, you can find it here: https://github.com/ferronsw/yii2-docker
For a quick test I've edited docker-php-entrypoint
at the moment (Changed first line).
There is no Alpine-Apache image for PHP, AFAIK. https://github.com/yiisoft/yii2-docker/commit/d7752899f8dc2075e6f58403c4daeab82c3b28a0#diff-69b55ecece009a14040cc4d99160ccdd73011ec45c16484a40758c107b5a0e03R87
You need to move ahead with fpm-nginx I think.
I've installed apache in the alpine php container myself. But this doesn't explain the problem right?
The error occurs because Alpine does not have bash
installed by default and our entry-scripts are using that.
You can try working based on: https://github.com/yiisoft/yii2-docker/tree/feature/alpine-2022 - with php-dev
images...
But beware, there are many failing tests:
> docker-compose run --rm -w /yii2 php-dev php -d error_reporting="E_ALL ^ E_DEPRECATED" vendor/bin/phpunit tests/framework/ --exclude db
Creating yii2fpm_php-dev_run ... done
PHPUnit 4.8.34 by Sebastian Bergmann and contributors.
............................................................. 61 / 4259 ( 1%)
............................................................. 122 / 4259 ( 2%)
............................................................. 183 / 4259 ( 4%)
............................................................. 244 / 4259 ( 5%)
............................................................. 305 / 4259 ( 7%)
............................................................. 366 / 4259 ( 8%)
............................................................. 427 / 4259 ( 10%)
............................................................. 488 / 4259 ( 11%)
............................................................. 549 / 4259 ( 12%)
............................................................. 610 / 4259 ( 14%)
............................................................. 671 / 4259 ( 15%)
............................................................. 732 / 4259 ( 17%)
............................................................. 793 / 4259 ( 18%)
............................................................. 854 / 4259 ( 20%)
............................................................. 915 / 4259 ( 21%)
............................................................. 976 / 4259 ( 22%)
...........S................................................. 1037 / 4259 ( 24%)
..........S.................................................. 1098 / 4259 ( 25%)
............................................................. 1159 / 4259 ( 27%)
............................................................. 1220 / 4259 ( 28%)
..........SSSSSSSSSSSSSSSSSS.............................S... 1281 / 4259 ( 30%)
.............SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.SSSSSSSSSSS 1342 / 4259 ( 31%)
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.................. 1403 / 4259 ( 32%)
............................................................. 1464 / 4259 ( 34%)
............................................................. 1525 / 4259 ( 35%)
............................................................. 1586 / 4259 ( 37%)
............................................................. 1647 / 4259 ( 38%)
............................................................. 1708 / 4259 ( 40%)
............................................................. 1769 / 4259 ( 41%)
............................................................. 1830 / 4259 ( 42%)
............................................................. 1891 / 4259 ( 44%)
............................................................. 1952 / 4259 ( 45%)
............................................................. 2013 / 4259 ( 47%)
.................................FF.......................... 2074 / 4259 ( 48%)
............................................................. 2135 / 4259 ( 50%)
.................FF.......................................... 2196 / 4259 ( 51%)
............................................................. 2257 / 4259 ( 52%)
............................................................. 2318 / 4259 ( 54%)
............................................................. 2379 / 4259 ( 55%)
............................................................. 2440 / 4259 ( 57%)
............................................................. 2501 / 4259 ( 58%)
........................................FF................... 2562 / 4259 ( 60%)
............................................................. 2623 / 4259 ( 61%)
............................................................. 2684 / 4259 ( 63%)
............................................................. 2745 / 4259 ( 64%)
......................F.F.................................... 2806 / 4259 ( 65%)
............................................................. 2867 / 4259 ( 67%)
............................................................. 2928 / 4259 ( 68%)
...............................S............................. 2989 / 4259 ( 70%)
............................................................. 3050 / 4259 ( 71%)
........I.................................................... 3111 / 4259 ( 73%)
............................................................. 3172 / 4259 ( 74%)
............................................................. 3233 / 4259 ( 75%)
............................................................. 3294 / 4259 ( 77%)
............................................................. 3355 / 4259 ( 78%)
............................................................. 3416 / 4259 ( 80%)
............................................................. 3477 / 4259 ( 81%)
............................................................. 3538 / 4259 ( 83%)
............................................................. 3599 / 4259 ( 84%)
.......................FF.................................... 3660 / 4259 ( 85%)
................................S............................ 3721 / 4259 ( 87%)
............................................................. 3782 / 4259 ( 88%)
............................................................. 3843 / 4259 ( 90%)
............................................................. 3904 / 4259 ( 91%)
............................................................I 3965 / 4259 ( 93%)
............................................................. 4026 / 4259 ( 94%)
............................................................. 4087 / 4259 ( 95%)
............................................................. 4148 / 4259 ( 97%)
............................................................. 4209 / 4259 ( 98%)
..................................................
You should really fix these slow tests (>500ms)...
1. 1005ms to run yiiunit\framework\mutex\FileMutexTest:testTimeout
2. 1004ms to run yiiunit\framework\mutex\RetryAcquireTraitTest:testRetryAcquire
Time: 4.72 seconds, Memory: 36.00MB
There were 10 failures:
1) yiiunit\framework\helpers\FormatConverterTest::testIntlIcuToPhpShortFormTime
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'g:i A'
+'g:i A'
/yii2/tests/framework/helpers/FormatConverterTest.php:56
/yii2/vendor/phpunit/phpunit/phpunit:52
/yii2/vendor/bin/phpunit:120
2) yiiunit\framework\helpers\FormatConverterTest::testIntlIcuToPhpShortFormDateTime
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'n/j/y, g:i A'
+'n/j/y, g:i A'
/yii2/tests/framework/helpers/FormatConverterTest.php:62
/yii2/vendor/phpunit/phpunit/phpunit:52
/yii2/vendor/bin/phpunit:120
3) yiiunit\framework\helpers\FormatConverterTest::testIntlIcuToJuiShortFormTime
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-': '
+': '
/yii2/tests/framework/helpers/FormatConverterTest.php:211
/yii2/vendor/phpunit/phpunit/phpunit:52
/yii2/vendor/bin/phpunit:120
4) yiiunit\framework\helpers\FormatConverterTest::testIntlIcuToJuiShortFormDateTime
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'m/d/y, : '
+'m/d/y, : '
/yii2/tests/framework/helpers/FormatConverterTest.php:217
/yii2/vendor/phpunit/phpunit/phpunit:52
/yii2/vendor/bin/phpunit:120
5) yiiunit\framework\helpers\InflectorTest::testTransliterateMedium
Failed asserting that '?Espanol?' is one of '¿Espanol?'.
/yii2/tests/TestCase.php:218
/yii2/tests/framework/helpers/InflectorTest.php:331
/yii2/vendor/phpunit/phpunit/phpunit:52
/yii2/vendor/bin/phpunit:120
6) yiiunit\framework\helpers\InflectorTest::testTransliterateLoose
Failed asserting that '?Espanol?' is one of 'Espanol?'.
/yii2/tests/TestCase.php:218
/yii2/tests/framework/helpers/InflectorTest.php:374
/yii2/vendor/phpunit/phpunit/phpunit:52
/yii2/vendor/bin/phpunit:120
7) yiiunit\framework\i18n\FormatterDateTest::testIntlAsTime
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-12:13:59 PM
+12:13:59 PM
/yii2/tests/framework/i18n/FormatterDateTest.php:146
/yii2/tests/framework/i18n/FormatterDateTest.php:134
/yii2/vendor/phpunit/phpunit/phpunit:52
/yii2/vendor/bin/phpunit:120
8) yiiunit\framework\i18n\FormatterDateTest::testIntlAsDatetime
Failed asserting that 'Dec 21, 2022, 12:13:59 PM' matches PCRE pattern "~Dec 21, 2022,? 12:13:59 PM~".
/yii2/tests/framework/i18n/FormatterDateTest.php:181
/yii2/tests/framework/i18n/FormatterDateTest.php:169
/yii2/vendor/phpunit/phpunit/phpunit:52
/yii2/vendor/bin/phpunit:120
9) yiiunit\framework\validators\NumberValidatorTest::testValidateValueSimple
Failed asserting that false is true.
/yii2/tests/framework/validators/NumberValidatorTest.php:86
/yii2/vendor/phpunit/phpunit/phpunit:52
/yii2/vendor/bin/phpunit:120
10) yiiunit\framework\validators\NumberValidatorTest::testValidateValueArraySimple
Failed asserting that false is true.
/yii2/tests/framework/validators/NumberValidatorTest.php:127
/yii2/vendor/phpunit/phpunit/phpunit:52
/yii2/vendor/bin/phpunit:120
FAILURES!
Tests: 4259, Assertions: 16044, Failures: 10, Skipped: 113, Incomplete: 2.
Thx! Any reason why composer is commented in the example file?
I get these warnings in both PHP 7.4 and 8.1:
Gathering patches for dependencies. This might take a minute.
- Installing phpunit/phpunit-mock-objects (2.3.8): Extracting archive
- Installing phpunit/php-file-iterator (1.4.5): Extracting archive
- Installing phpunit/phpunit (4.8.34): Extracting archive
- Applying patches for phpunit/phpunit-mock-objects
https://yiisoft.github.io/phpunit-patches/phpunit_mock_objects.patch (Fix PHP 7 and 8 compatibility)
Could not apply patch! Skipping. The error was: Cannot apply patch https://yiisoft.github.io/phpunit-patches/phpunit_mock_objects.patch
In Patches.php line 326:
Cannot apply patch Fix PHP 7 and 8 compatibility (https://yiisoft.github.io/phpunit-patches/phpunit_mock_objects.patch)!
Thx! Any reason why composer is commented in the example file?
Was also due to missing bash
- I've updated the fork.
FYI - even with
tzdata \
icu-data-full \
icu-libs \
test results are the same :(
Because I still can't run the tests myself. Because of the error when running composer install
.
@schmunk42 Can you help me why I can't run the tests?
PHP version: 8.1.13
529e853ea7e9:/yii2# composer install
Gathering patches for root package.
Removing package phpunit/php-file-iterator so that it can be re-installed and re-patched.
- Removing phpunit/php-file-iterator (1.4.5)
Removing package phpunit/phpunit so that it can be re-installed and re-patched.
- Removing phpunit/phpunit (4.8.34)
Removing package phpunit/phpunit-mock-objects so that it can be re-installed and re-patched.
- Removing phpunit/phpunit-mock-objects (2.3.8)
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Package operations: 3 installs, 0 updates, 0 removals
Gathering patches for root package.
Gathering patches for dependencies. This might take a minute.
- Installing phpunit/phpunit-mock-objects (2.3.8): Extracting archive
- Installing phpunit/php-file-iterator (1.4.5): Extracting archive
- Installing phpunit/phpunit (4.8.34): Extracting archive
- Applying patches for phpunit/phpunit-mock-objects
https://yiisoft.github.io/phpunit-patches/phpunit_mock_objects.patch (Fix PHP 7 and 8 compatibility)
Could not apply patch! Skipping. The error was: Cannot apply patch https://yiisoft.github.io/phpunit-patches/phpunit_mock_objects.patch
In Patches.php line 326:
Cannot apply patch Fix PHP 7 and 8 compatibility (https://yiisoft.github.io/phpunit-patches/phpunit_mock_objects.patch)!
Try adding patch
to the dev image.
See also:
Thanks, that works :) The strange thing is everyone says adding icu-data-full
should work, but it doesn't. This also worked for other images I build.
Yeah, I recall that you had to recompile or patch some libs for Alpine.
https://wiki.musl-libc.org/open-issues Locale limitations Locale support is very limited, and barely works. Translation of LC_TIME is not possible because the key strings for ABMON_5 and MON_5 (“May”) are identical. Custom collation orders (LC_COLLATE) are not implemented at all, despite there always having been an intent to support them. LC_NUMERIC and LC_MONETARY also admit no variation by locale. Solving these problems requires a major overhaul, but the main missing prerequisite is involvement from users who want the functionality.
Alpine images aren't that great because of musl. Quite significant performance drop compared to glibc. Up to 30%.
Would it be possible to create an alpine variant of all/most container images? The default php apache 8.1 uses debian an has many high and critical vulnerabilities. I've also scanned the php 8.1 alpine image and that one doesn't have any vulnerabilities.
Trivy (vulnerability scanner) output for the default php:8.1-apache image tag.
if you download this html you get easier readable view.
It are so many that the list is too long for this comment, so I put it in a file in a repo.