-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from openfoodfacts/0.3.x-dev
feat: 0.3.x dev - Update dependencies and PHP to 8.1
- Loading branch information
Showing
25 changed files
with
292 additions
and
203 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,5 @@ | ||
# Docker | ||
USER_ID=1000 | ||
GROUP_ID=1000 | ||
# For Composer (installing packages - optional) | ||
#GITHUB_TOKEN="${GITHUB_TOKEN}" |
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
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,14 +1,21 @@ | ||
<?php | ||
|
||
$finder = PhpCsFixer\Finder::create() | ||
->in(['src', 'tests']) | ||
$config = new PhpCsFixer\Config(); | ||
$finder = $config->getFinder(); | ||
$finder | ||
->in(['src','tests']) | ||
; | ||
|
||
$config = new PhpCsFixer\Config(); | ||
return $config->setRules([ | ||
return $config | ||
->setRules([ | ||
'@PSR12' => true, | ||
'array_indentation' => true, | ||
'array_syntax' => ['syntax' => 'short'], | ||
'single_quote' => true, | ||
'blank_line_before_statement' => true, | ||
'no_spaces_around_offset' => true, | ||
'no_unused_imports' => true, | ||
'ternary_operator_spaces' => true, | ||
]) | ||
->setFinder($finder) | ||
; | ||
->setUsingCache(false) | ||
; |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
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 | ||
|
||
install: | ||
docker compose exec php-fpm bash -c 'XDEBUG_MODE=off composer install' | ||
|
||
fix: | ||
docker compose exec php-fpm bash -c 'XDEBUG_MODE=off ./vendor/bin/php-cs-fixer fix' | ||
|
||
test: | ||
docker compose exec php-fpm bash -c 'XDEBUG_MODE=off ./vendor/bin/phpunit' | ||
|
||
composer: | ||
docker compose exec php-fpm bash -c "XDEBUG_MODE=off composer $(filter-out $@,$(MAKECMDGOALS))" |
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 |
---|---|---|
|
@@ -16,17 +16,23 @@ | |
{ | ||
"name": "Roberto Moreno", | ||
"email": "[email protected]", | ||
"homepage": "http://www.rampmaster.org", | ||
"homepage": "https://rampmaster.org/", | ||
"role": "Wrapper Developer" | ||
}, | ||
{ | ||
"name": "Colin Benoit", | ||
"homepage": "https://github.com/Benoit382", | ||
"role": "PHP Developer" | ||
} | ||
], | ||
"require": { | ||
"php": "^7.2|^8.0", | ||
"php": "^8.1", | ||
"ext-json": "*", | ||
"ext-curl": "*", | ||
"guzzlehttp/guzzle": "^6.3|^7.0", | ||
"psr/log": "^1.0", | ||
"psr/simple-cache": "^1.0" | ||
"ext-gd": "*", | ||
"guzzlehttp/guzzle": "^7.4", | ||
"psr/log": "^3.0", | ||
"psr/simple-cache": "^3.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
|
@@ -35,12 +41,10 @@ | |
} | ||
}, | ||
"require-dev": { | ||
"ext-gd": "*", | ||
"monolog/monolog": "^1.23", | ||
"symfony/cache": "^4.3", | ||
"phpunit/phpunit": "^8.5|^9.5", | ||
"phpstan/phpstan": "^0.12.99", | ||
"phpstan/phpstan-phpunit": "^0.12.22", | ||
"friendsofphp/php-cs-fixer": "^3.1" | ||
"symfony/cache": "^6.1.3", | ||
"phpunit/phpunit": "^9.5.21", | ||
"phpstan/phpstan": "^1.8.2", | ||
"phpstan/phpstan-phpunit": "^1.1.1", | ||
"friendsofphp/php-cs-fixer": "^3.9.5" | ||
} | ||
} |
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,25 @@ | ||
version: '3.7' | ||
|
||
services: | ||
php-fpm: | ||
container_name: openfoodfacts-php | ||
build: | ||
context: . | ||
dockerfile: ./docker/php/Dockerfile | ||
args: | ||
GITHUB_TOKEN: $GITHUB_TOKEN | ||
GROUP_ID: $GROUP_ID | ||
USER_ID: $USER_ID | ||
environment: | ||
XDEBUG_CONFIG: client_host=host.docker.internal | ||
image: somecoding/crawler-php-fpm | ||
volumes: | ||
- .:/var/www/html:delegated | ||
- ./docker/php/php.ini:/usr/local/etc/php/conf.d/php.ini | ||
- ./docker/php/docker-php-ext-xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini | ||
- ./docker/php/fpm_additional.conf:/usr/local/etc/php-fpm.d/zzzz-fpm_additional.conf # zzzz- to be loaded last: overwrites all before | ||
- ./xdebug_profile:/tmp/profile:delegated | ||
networks: | ||
- default | ||
extra_hosts: | ||
- "host.docker.internal:host-gateway" |
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,50 @@ | ||
# syntax=docker/dockerfile:experimental | ||
FROM composer:2 AS COMPOSER | ||
ENV COMPOSER_HOME=/usr/config/composer | ||
ENV GITHUB_TOKEN="" | ||
RUN if [[ -z "$GITHUB_TOKEN" ]] ; then echo Github Token not provided ; else composer config -g github-oauth.github.com $GITHUB_TOKEN; fi | ||
|
||
FROM php:8.1-fpm | ||
|
||
ENV COMPOSER_HOME=/usr/config/composer | ||
ARG USER_ID | ||
ARG GROUP_ID | ||
RUN usermod -u $USER_ID www-data && groupmod -g $GROUP_ID www-data | ||
|
||
# Install php-src extensions | ||
RUN apt-get -qq update && apt-get -qq --no-install-recommends install \ | ||
libzip-dev \ | ||
unzip \ | ||
libpng-dev \ | ||
libjpeg-dev \ | ||
mariadb-client \ | ||
git > /dev/null && \ | ||
pecl install xdebug-3.1.6 > /dev/null && \ | ||
docker-php-ext-enable xdebug > /dev/null && \ | ||
pecl install -o -f redis-5.3.4 > /dev/null && \ | ||
docker-php-ext-install \ | ||
-j$(nproc) \ | ||
zip \ | ||
gd \ | ||
bcmath \ | ||
pdo_mysql > /dev/null && \ | ||
rm -rf /tmp/pear > /dev/null && \ | ||
rm -rf /var/lib/apt/lists/* | ||
RUN mkdir /tmp/profile; chmod 755 /tmp/profile | ||
|
||
# Install composer and dependencies | ||
COPY --chown=root:root --from=COMPOSER --chmod=755 /usr/bin/composer /usr/bin/composer | ||
|
||
|
||
ENV GITHUB_TOKEN="" | ||
###COPY --chown=www-data:www-data --from=COMPOSER /usr/config/composer /usr/config/composer | ||
#Re-enable aboce COPY when Token is set | ||
|
||
# Make sure composer can checkout github | ||
RUN mkdir -p /var/www/.ssh/ && \ | ||
touch /var/www/.ssh/known_hosts && \ | ||
ssh-keyscan github.com >> /var/www/.ssh/known_hosts | ||
|
||
WORKDIR /var/www/html | ||
|
||
USER www-data |
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,6 @@ | ||
zend_extension=xdebug | ||
|
||
xdebug.mode=debug,profile | ||
xdebug.client_port= 9000 | ||
xdebug.start_with_request=yes | ||
xdebug.output_dir = /tmp/profile |
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,7 @@ | ||
[www] | ||
pm = dynamic | ||
pm.max_children = 20 | ||
pm.start_servers = 10 | ||
pm.min_spare_servers = 5 | ||
pm.max_spare_servers = 20 | ||
pm.max_requests = 250 |
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,4 @@ | ||
max_execution_time=600 | ||
memory_limit=-1 | ||
session.cookie_httponly = 1; // Make sonarcloud happy - docker is for local dev only | ||
session.cookie_secure = 1; |
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
Oops, something went wrong.