Skip to content

Commit

Permalink
feat 1374: decker change PHP 7
Browse files Browse the repository at this point in the history
  • Loading branch information
stakovicz committed Dec 13, 2023
1 parent 6ec38bf commit 4989109
Show file tree
Hide file tree
Showing 22 changed files with 39 additions and 297 deletions.
2 changes: 1 addition & 1 deletion .env-dist
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
## Options to pass to `docker-compose up` command
## Options to pass to `docker compose up` command
#DOCKER_UP_OPTIONS= -d # -d will launch container in detached mode
#ENABLE_XDEBUG=true # enable the PHP xDebug extension
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,3 @@ js_dist
/composer.phar
/data

/event/vendor
/event/wp
/event/composer-setup.php
/event/composer-temp.phar
36 changes: 18 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ DOCKER_UP_OPTIONS ?=
install: vendors

docker-up: .env var/logs/.docker-build data docker-compose.override.yml
CURRENT_UID=$(CURRENT_UID) docker-compose up $(DOCKER_UP_OPTIONS)
CURRENT_UID=$(CURRENT_UID) docker compose up $(DOCKER_UP_OPTIONS)

docker-stop:
CURRENT_UID=$(CURRENT_UID) docker-compose stop
CURRENT_UID=$(CURRENT_UID) docker compose stop

docker-down:
CURRENT_UID=$(CURRENT_UID) docker-compose down
CURRENT_UID=$(CURRENT_UID) docker compose down

var/logs/.docker-build: docker-compose.yml docker-compose.override.yml $(shell find docker -type f)
CURRENT_UID=$(CURRENT_UID) ENABLE_XDEBUG=$(ENABLE_XDEBUG) docker-compose build
CURRENT_UID=$(CURRENT_UID) ENABLE_XDEBUG=$(ENABLE_XDEBUG) docker compose build
touch var/logs/.docker-build

.env:
Expand Down Expand Up @@ -59,24 +59,24 @@ init:

init-db:
make reset-db
CURRENT_UID=$(CURRENT_UID) docker-compose run --rm cliphp make db-migrations
CURRENT_UID=$(CURRENT_UID) docker-compose run --rm cliphp make db-seed
CURRENT_UID=$(CURRENT_UID) docker compose run --rm cliphp make db-migrations
CURRENT_UID=$(CURRENT_UID) docker compose run --rm cliphp make db-seed

config: configs/application/config.php app/config/parameters.yml
CURRENT_UID=$(CURRENT_UID) docker-compose run --no-deps --rm cliphp make vendors
CURRENT_UID=$(CURRENT_UID) docker-compose run --no-deps --rm cliphp make assets
CURRENT_UID=$(CURRENT_UID) docker compose run --no-deps --rm cliphp make vendors
CURRENT_UID=$(CURRENT_UID) docker compose run --no-deps --rm cliphp make assets

test:
./bin/atoum
./bin/php-cs-fixer fix --dry-run -vv


test-functional: data config htdocs/uploads
CURRENT_UID=$(CURRENT_UID) docker-compose stop dbtest apachephptest planetetest mailcatcher
CURRENT_UID=$(CURRENT_UID) docker-compose up -d dbtest apachephptest planetetest mailcatcher
CURRENT_UID=$(CURRENT_UID) docker-compose run --no-deps --rm cliphp ./bin/behat
CURRENT_UID=$(CURRENT_UID) docker-compose run --no-deps --rm cliphp ./bin/behat -c behat-planete.yml
CURRENT_UID=$(CURRENT_UID) docker-compose stop dbtest apachephptest planetetest mailcatcher
CURRENT_UID=$(CURRENT_UID) docker compose stop dbtest apachephptest planetetest mailcatcher
CURRENT_UID=$(CURRENT_UID) docker compose up -d dbtest apachephptest planetetest mailcatcher
CURRENT_UID=$(CURRENT_UID) docker compose run --no-deps --rm cliphp ./bin/behat
CURRENT_UID=$(CURRENT_UID) docker compose run --no-deps --rm cliphp ./bin/behat -c behat-planete.yml
CURRENT_UID=$(CURRENT_UID) docker compose stop dbtest apachephptest planetetest mailcatcher

data:
mkdir data
Expand All @@ -89,17 +89,17 @@ hooks: .git/hooks/pre-commit .git/hooks/post-checkout

.git/hooks/pre-commit: Makefile
echo "#!/bin/sh" > .git/hooks/pre-commit
echo "docker-compose run --rm cliphp make test" >> .git/hooks/pre-commit
echo "docker compose run --rm cliphp make test" >> .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit

.git/hooks/post-checkout: Makefile
echo "#!/bin/sh" > .git/hooks/post-checkout
echo "docker-compose run --rm cliphp make vendor" >> .git/hooks/post-checkout
echo "docker compose run --rm cliphp make vendor" >> .git/hooks/post-checkout
chmod +x .git/hooks/post-checkout

reset-db:
echo 'DROP DATABASE IF EXISTS web' | docker-compose run --rm db /opt/mysql_no_db
echo 'CREATE DATABASE web' | docker-compose run --rm db /opt/mysql_no_db
echo 'DROP DATABASE IF EXISTS web' | docker compose run -T --rm db /opt/mysql_no_db
echo 'CREATE DATABASE web' | docker compose run -T --rm db /opt/mysql_no_db

db-migrations:
php bin/phinx migrate
Expand All @@ -108,7 +108,7 @@ db-seed:
php bin/phinx seed:run

console:
CURRENT_UID=$(CURRENT_UID) docker-compose run --rm cliphp bash
CURRENT_UID=$(CURRENT_UID) docker compose run --rm cliphp bash

phpstan:
docker run -v $(shell pwd):/app --rm ghcr.io/phpstan/phpstan
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ Vous pouvez aussi y accéder directement via la commande: `docker/bin/mysql`
* `make docker-stop` : éteint les containers en fonctionnement.
* `make docker-down` : détruit les containers existants.
* `docker/bin/mysql` : connexion à la base de données.
* `docker/bin/bash` : PHP 5.6 cli.
* `docker/bin/bashphp7` : PHP 7.0 cli.
* `docker/bin/bash` : PHP cli.

### Configuration avancée

Expand All @@ -42,7 +41,7 @@ Ce fichier contient la liste des options disponibles.

#### `DOCKER_UP_OPTIONS`

liste des options à passer à la commande `docker-composer up`.
liste des options à passer à la commande `docker composer up`.

## Base de données

Expand Down
8 changes: 4 additions & 4 deletions configs/application/config-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
$configuration['bdd']['utilisateur']='afup';
$configuration['bdd']['mot_de_passe']='afup';
$configuration['web']['path']='/';

$configuration['divers']['niveau_erreur']='32767';
$configuration['divers']['afficher_erreurs']='1';
$configuration['mails']['serveur_smtp']='mailcatcher';
Expand All @@ -16,6 +15,7 @@
$configuration['mails']['port']='1025';
$configuration['mails']['username']='';
$configuration['mails']['password']='';
$configuration['mails']['texte_adhesion_personne_physique']='';
$configuration['afup']['raison_sociale']='AFUP';
$configuration['afup']['adresse']='32, Boulevard de Strasbourg
CS 30108';
Expand All @@ -28,7 +28,7 @@
$configuration['rib']['guichet']='06076';
$configuration['rib']['compte']='00020707701';
$configuration['rib']['cle']='70';
$configuration['rib']['domiciliation']="CCM PARIS MAGENTA GARE DE L'EST";
$configuration['rib']['domiciliation']='CCM PARIS MAGENTA GARE DE L\'EST';
$configuration['rib']['bic']='CMCIFR2A';
$configuration['rib']['iban']='FR76 1027 8060 7600 0207 0770 170';
$configuration['rib_ce']['valid_until']='2023-01-01';
Expand All @@ -45,7 +45,6 @@
$configuration['bureau']['3']='paxal';
$configuration['bureau']['4']='ChristopheVilleneuve';
$configuration['bureau']['5']='LaurenceHoizey';

$configuration['planete']['pertinence']='php|afup|pear|pecl|symfony|copix|jelix|wampserver|simpletest|simplexml|zend|pmo|drupal|ovidentia|mvc|magento|chrome|spip|PDO|mock|cake|hiphop|CMS|Framework|typo3|photon|pattern';
$configuration['site']['prefix']='pages/site/';
$configuration['site']['query_prefix']='?route=';
Expand All @@ -58,5 +57,6 @@
$configuration['sympa']['mot_de_passe']='sympa';
$configuration['sympa']['directory']='http://127.0.0.1/sympa.php';
$configuration['sympa']['config_url']='http://127.0.0.1/sympa.php';
$configuration['sympa']['host'] = 'old.afup.org';
$configuration['sympa']['host']='old.afup.org';
$configuration['soumettre']='Enregistrer';
return $configuration;
5 changes: 0 additions & 5 deletions docker-compose.override.yml-dist
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,3 @@ services:
mailcatcher:
ports:
- "1181:1080"
apachephp7:
ports:
- "9235:80"
# environment:
# XDEBUG_CONFIG: "remote_connect_back=1 profiler_enable=1 remote_autostart=0 remote_enable=1"
37 changes: 4 additions & 33 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,6 @@ services:
- db
- mailcatcher

apachephp7:
build:
context: ./docker/dockerfiles/apachephp7
args:
uid: ${CURRENT_UID:-1001}
gid: "1001"
ENABLE_XDEBUG: ${ENABLE_XDEBUG:-false}
environment:
SYMFONY_ENV: "dev"
volumes:
- ./:/var/www/html
links:
- db
- mailcatcher

apachephptest:
build:
context: ./docker/dockerfiles/apachephp
Expand Down Expand Up @@ -128,22 +113,8 @@ services:
- dbtest
command: "false"

cliphp7:
build:
context: ./docker/dockerfiles/apachephp7
args:
uid: ${CURRENT_UID:-1001}
gid: "1001"
ENABLE_XDEBUG: ${ENABLE_XDEBUG:-false}
user: localUser
volumes:
- ./data/composer:/home/localUser/.composer
- ./:/var/www/html
links:
- db
- mailcatcher
command: "false"

mailcatcher:
build:
context: ./docker/dockerfiles/mailcatcher
image: dockage/mailcatcher:0.9.0
ports:
- "1080:1080"
- "1025:1025"
2 changes: 1 addition & 1 deletion docker/bin/bash
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
docker-compose run --rm cliphp /bin/bash
docker compose run --rm cliphp /bin/bash
2 changes: 0 additions & 2 deletions docker/bin/bashphp7

This file was deleted.

3 changes: 1 addition & 2 deletions docker/bin/mysql
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
#!/bin/bash
docker-compose run --rm db /opt/mysql

docker compose run --rm db /opt/mysql
3 changes: 1 addition & 2 deletions docker/bin/mysql_event
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
#!/bin/bash
docker-compose run --rm dbevent /opt/mysql

docker compose run --rm dbevent /opt/mysql
11 changes: 6 additions & 5 deletions docker/dockerfiles/apachephp/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM php:5.6-apache

ARG ENABLE_XDEBUG=false
FROM php:7.0-apache

RUN echo 'deb http://archive.debian.org/debian stretch main' > /etc/apt/sources.list

ARG ENABLE_XDEBUG=false

## Update system
RUN apt-get update && \
apt-get upgrade -y && \
Expand All @@ -24,8 +24,8 @@ RUN apt-get update && \
libicu-dev \
wget && \
docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && \
docker-php-ext-install pdo_mysql mbstring mysqli zip gd mcrypt intl && \
if [ "$ENABLE_XDEBUG" = "true" ]; then pecl install xdebug-2.5.5 && docker-php-ext-enable xdebug; fi && \
docker-php-ext-install pdo_mysql mbstring mysqli zip gd mcrypt intl pcntl && \
if [ "$ENABLE_XDEBUG" = "true" ]; then pecl install xdebug-2.6.1 && docker-php-ext-enable xdebug; fi && \
apt-get autoremove --purge -y && \
rm -rf /var/lib/apt/lists/*

Expand All @@ -45,6 +45,7 @@ RUN apt-get update && \
gnupg && \
curl -k -sL https://deb.nodesource.com/setup_6.x | bash - && \
apt-get install -y nodejs && \
apt-get autoremove --purge -y && \
rm -rf /var/lib/apt/lists/*

RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
Expand Down
73 changes: 0 additions & 73 deletions docker/dockerfiles/apachephp7/Dockerfile

This file was deleted.

12 changes: 0 additions & 12 deletions docker/dockerfiles/apachephp7/apache.conf

This file was deleted.

35 changes: 0 additions & 35 deletions docker/dockerfiles/apachephp7/apache.crt

This file was deleted.

Loading

0 comments on commit 4989109

Please sign in to comment.