-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: docker update * feat: sonar cube review
- Loading branch information
Showing
15 changed files
with
65 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
vendor |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,20 @@ | ||
# Created by .ignore support plugin (hsz.mobi) | ||
### Example user template template | ||
### Example user template | ||
# Folder use for the coverage | ||
/build/ | ||
/bin/ | ||
|
||
# IntelliJ project files | ||
# IntelliJ project files (should on developer pc not here) | ||
.idea | ||
*.iml | ||
out | ||
gen### Composer template | ||
composer.phar | ||
|
||
## Never send vendor | ||
/vendor/ | ||
/log/ | ||
/tests/tmp/* | ||
.env | ||
/xdebug_profile/ | ||
|
||
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file | ||
# You may choose to ignore a library lock file https://getcomposer.org/doc/02-libraries.md#lock-file | ||
composer.lock | ||
|
||
## Temporary test files | ||
|
||
/tests/tmp/* | ||
## Phpunit and cs-fixer cache file | ||
.phpunit.result.cache | ||
.php-cs-fixer.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,22 @@ | ||
|
||
php-setup: | ||
test -e .env || cp .env.example .env | ||
docker compose down | ||
docker compose rm | ||
docker compose build | ||
docker compose up -d --force-recreate | ||
make composer install | ||
docker build -t openfoodfacts-php -f ./docker/Dockerfile . | ||
|
||
install: | ||
docker compose exec php-fpm bash -c 'XDEBUG_MODE=off composer install' | ||
.PHONY: ci | ||
ci: cs-check phpstan test | ||
|
||
fix: | ||
docker compose exec php-fpm bash -c 'XDEBUG_MODE=off ./vendor/bin/php-cs-fixer fix' | ||
.PHONY: cs-check | ||
cs-check: | ||
docker run -v ${PWD}/src:/opt/app/src -v ${PWD}/tests:/opt/app/tests openfoodfacts-php php ./vendor/bin/php-cs-fixer check | ||
|
||
.PHONY: cs-fix | ||
cs-fix: | ||
docker run -v ${PWD}/src:/opt/app/src -v ${PWD}/tests:/opt/app/tests openfoodfacts-php php ./vendor/bin/php-cs-fixer fix | ||
|
||
.PHONY: test | ||
test: | ||
docker compose exec php-fpm bash -c 'XDEBUG_MODE=off ./vendor/bin/phpunit' | ||
docker run -v ${PWD}/src:/opt/app/src -v ${PWD}/tests:/opt/app/tests -v ${PWD}/build:/opt/app/build -u $(id -u ${USER}):$(id -g ${USER}) openfoodfacts-php php ./vendor/bin/phpunit | ||
|
||
composer: | ||
docker compose exec php-fpm bash -c "XDEBUG_MODE=off composer $(filter-out $@,$(MAKECMDGOALS))" | ||
.PHONY: phpstan | ||
phpstan: | ||
docker run -v ${PWD}/src:/opt/app/src -v ${PWD}/tests:/opt/app/tests -v ${PWD}/build:/opt/app/build openfoodfacts-php php ./vendor/bin/phpstan |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# syntax=docker/dockerfile:experimental | ||
FROM composer:2 AS COMPOSER | ||
WORKDIR /opt/app | ||
COPY composer.json . | ||
RUN composer install --no-scripts --ignore-platform-reqs | ||
|
||
#no need php-fpm when all command use php-cli | ||
FROM php:8-bookworm | ||
WORKDIR /opt/app | ||
# Install php-src extensions | ||
RUN DEBIAN_FRONTEND=noninteractive apt-get -qq update && \ | ||
apt-get -qq --no-install-recommends install libpng-dev libjpeg-dev | ||
RUN pecl install xdebug | ||
RUN docker-php-ext-enable xdebug | ||
RUN docker-php-ext-install -j$(nproc) gd bcmath | ||
RUN rm -rf /tmp/pear /var/lib/apt/lists/* | ||
RUN mkdir /tmp/profile; chmod 755 /tmp/profile | ||
|
||
USER nobody | ||
COPY ./docker/xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini | ||
|
||
COPY --from=COMPOSER /opt/app /opt/app | ||
# Not permited by Sonar cube even though there is .dockerignore to remove sensitive data | ||
#COPY . . | ||
COPY src . | ||
COPY tests . | ||
COPY .php-cs-fixer.dist.php . | ||
COPY phpunit.xml . | ||
COPY phpstan.neon.dist . |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
zend_extension=xdebug | ||
|
||
xdebug.mode=coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
|
||
<?php | ||
|
||
use Symfony\Component\Cache\Adapter\FilesystemAdapter; | ||
use Symfony\Component\Cache\Psr16Cache; | ||
|
||
include '../../vendor/autoload.php'; | ||
include_once '../../vendor/autoload.php'; | ||
$logger = new \Psr\Log\NullLogger; | ||
$httpClient = new \GuzzleHttp\Client(); | ||
// the PSR-6 cache object that you want to use (you might also use a PSR-16 Interface Object directly) | ||
$psr6Cache = new FilesystemAdapter(); | ||
$psr16Cache = new Psr16Cache($psr6Cache); | ||
$api = new \OpenFoodFacts\Api('food', 'world', $logger, $httpClient, $psr16Cache); | ||
$product = $api->getProduct(rand(1, 50)); | ||
$product = $api->getProduct(random_int(1, 50)); |
Empty file.