Skip to content

Commit a02c44f

Browse files
committed
refacto: Move some file to match with comment
1 parent 1ee2ec5 commit a02c44f

File tree

34 files changed

+101
-152
lines changed

34 files changed

+101
-152
lines changed

.docker/php/conf.d/20-app.prod.ini

Lines changed: 0 additions & 3 deletions
This file was deleted.

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
data/
1+
data/

.editorconfig

Lines changed: 0 additions & 10 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ jobs:
7878
key: |
7979
docker-${{ runner.os }}-${{ hashFiles(
8080
'compose.yml',
81-
'docker/dockerfiles/apachephp/Dockerfile',
82-
'docker/dockerfiles/mysql/Dockerfile',
83-
'docker/dockerfiles/mysqltest/Dockerfile'
81+
'docker/apachephp/Dockerfile',
82+
'docker/mysql/dev/Dockerfile',
83+
'docker/mysql/test/Dockerfile'
8484
) }}
8585
8686
- name: Tests - Functional
@@ -120,9 +120,9 @@ jobs:
120120
key: |
121121
docker-${{ runner.os }}-${{ hashFiles(
122122
'compose.yml',
123-
'Dockerfile',
124-
'docker/dockerfiles/mysql/Dockerfile',
125-
'docker/dockerfiles/mysqltest/Dockerfile'
123+
'docker/apachephp/Dockerfile',
124+
'docker/mysql/dev/Dockerfile',
125+
'docker/mysql/test/Dockerfile'
126126
) }}
127127
128128
- name: Tests - Integration
@@ -150,4 +150,9 @@ jobs:
150150
composer-options: "--no-scripts"
151151

152152
- name: Rector
153-
run: make rector
153+
run: |
154+
cp docker.env docker.env.local
155+
cp -n .env.dist .env
156+
docker compose up -d
157+
docker compose exec --user localUser apachephp composer install --no-scripts
158+
docker compose exec -u localUser apachephp ./bin/phpunit --testsuite integration

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
###> docker file ###
55
docker.env.local
6-
.docker/data/history
6+
docker/data/history
77

88
deps.lock
99
.idea

Dockerfile

Lines changed: 0 additions & 104 deletions
This file was deleted.

Makefile

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ TEXT_BOLD = \033[1m
1414
##@ Setup 📜
1515
### Installer le projet from scratch
1616
install:
17-
cp -n .env.dist .env && cp -n docker.env docker.env.local && cp -n .docker/data/history.dist .docker/data/history && cp -n compose.override.yml-dist compose.override.yml
17+
cp -n .env.dist .env && cp -n docker.env docker.env.local && cp -n ./docker/data/history.dist ./docker/data/history && cp -n compose.override.yml-dist compose.override.yml
1818
mkdir -p ./htdocs/uploads -p ./tmp
1919

2020
$(DOCKER_COMPOSE_BIN) up -d --build
@@ -26,15 +26,15 @@ install:
2626
$(MAKE) --no-print-directory build-assets
2727

2828
# Reset la base de donnée
29-
cat ./.docker/mysql/reset-db.sql | $(DOCKER_COMPOSE_BIN) run -T --rm db /opt/mysql_no_db
29+
cat ./docker/mysql/reset-db.sql | $(DOCKER_COMPOSE_BIN) run -T --rm db /opt/mysql_no_db
3030

3131
$(DOCKER_COMPOSE_BIN) exec --user localUser apachephp php bin/phinx migrate
3232
$(DOCKER_COMPOSE_BIN) exec --user localUser apachephp php bin/phinx seed:run
3333

3434
### Supprime les volumes docker, les fichiers et les dossier généré par le projet
3535
reset:
3636
$(DOCKER_COMPOSE_BIN) down --remove-orphans -v
37-
rm -f ./.env -f ./docker.env.local -f .docker/data/history -f compose.override.yml
37+
rm -f ./.env -f ./docker.env.local -f ./docker/data/history -f compose.override.yml
3838
sudo rm -rf ./var ./vendor ./node_modules ./htdocs/bundles ./htdocs/docs ./htdocs/uploads ./htdocs/assets ./tmp
3939

4040
### Reinstalle le projet from scratch
@@ -71,7 +71,7 @@ test-integration: # not work
7171

7272
### Tests fonctionnels
7373
behat:
74-
$(DOCKER_COMPOSE_BIN) exec --user localUser apachephptest ./bin/behat
74+
$(DOCKER_COMPOSE_BIN) exec --user localUser apachephp ./bin/behat
7575

7676
### PHP CS Fixer (dry run)
7777
cs-lint:
@@ -81,13 +81,16 @@ cs-lint:
8181
cs-fix:
8282
$(DOCKER_COMPOSE_BIN) exec --user localUser apachephp ./bin/php-cs-fixer fix -vv
8383

84-
### (Dans Docker) Rector (dry run)
84+
### Rector (dry run)
8585
rector: var/cache/dev/AppKernelDevDebugContainer.xml
86-
./bin/rector --dry-run
86+
$(DOCKER_COMPOSE_BIN) exec --user localUser apachephp ./bin/rector --dry-run
8787

88-
### (Dans Docker) Rector (fix)
88+
### Rector (fix)
8989
rector-fix: var/cache/dev/AppKernelDevDebugContainer.xml
90-
./bin/rector
90+
$(DOCKER_COMPOSE_BIN) exec --user localUser apachephp ./bin/rector
91+
92+
var/cache/dev/AppKernelDevDebugContainer.xml:
93+
$(DOCKER_COMPOSE_BIN) exec --user localUser apachephp bin/console cache:warmup --env=dev
9194

9295
### Tests fonctionnels
9396
test-functional:
@@ -125,7 +128,7 @@ pre-commit: Makefile
125128

126129
post-checkout: Makefile
127130
echo "#!/bin/sh" > .git/hooks/post-checkout
128-
echo "docker compose run --rm -u localUser apachephp make vendor" >> .git/hooks/post-checkout
131+
echo "docker compose run --rm -u localUser apachephp composer install --no-scripts" >> .git/hooks/post-checkout
129132
chmod +x .git/hooks/post-checkout
130133

131134
help:
@@ -147,6 +150,3 @@ help:
147150

148151
.PHONY: install tests hooks console phpstan help
149152
.SILENT: help
150-
151-
var/cache/dev/AppKernelDevDebugContainer.xml:
152-
php bin/console cache:warmup --env=dev

compose.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
services:
22
apachephp:
33
build:
4-
context: .
4+
context: ./docker/apachephp
55
target: afup_web_dev
66
container_name: afup-web-apachephp
77
environment:
@@ -13,15 +13,15 @@ services:
1313
volumes:
1414
- ./:/var/www/html
1515
# Permet d'avoir un bash history ainsi que des alias bash quand on est dans le container
16-
- ./.docker/config/bashrc:/home/localUser/.bashrc
17-
- ./.docker/config/bash_aliases:/home/localUser/.bash_aliases
18-
- ./.docker/data/history:/home/localUser/.bash_history
16+
- ./docker/config/bashrc:/home/localUser/.bashrc
17+
- ./docker/config/bash_aliases:/home/localUser/.bash_aliases
18+
- ./docker/data/history:/home/localUser/.bash_history
1919
depends_on:
2020
- db
2121
- mailcatcher
2222

2323
db:
24-
build: ./docker/dockerfiles/mysql
24+
build: ./docker/mysql/dev
2525
container_name: afup-web-db
2626
environment:
2727
MYSQL_ROOT_PASSWORD: root
@@ -44,7 +44,7 @@ services:
4444
profiles: [front] # Avec ce paramètre node n'est pas lancé quand on docker compose up
4545

4646
dbtest:
47-
build: ./docker/dockerfiles/mysqltest
47+
build: ./docker/mysql/test
4848
container_name: afup-web-db-test
4949
environment:
5050
MYSQL_ROOT_PASSWORD: root
@@ -60,7 +60,7 @@ services:
6060

6161
apachephptest:
6262
build:
63-
context: .
63+
context: ./docker/apachephp
6464
target: afup_web_dev
6565
container_name: afup-web-apachephp-test
6666
environment:
@@ -74,9 +74,9 @@ services:
7474
volumes:
7575
- ./:/var/www/html
7676
# Permet d'avoir un bash history ainsi que des alias bash quand on est dans le container
77-
- ./.docker/config/bashrc:/localUser/.bashrc
78-
- ./.docker/config/bash_aliases:/localUser/.bash_aliases
79-
- ./.docker/data/history:/localUser/.bash_history
77+
- ./docker/config/bashrc:/localUser/.bashrc
78+
- ./docker/config/bash_aliases:/localUser/.bash_aliases
79+
- ./docker/data/history:/localUser/.bash_history
8080
healthcheck:
8181
test: [ "CMD", "curl", "-f", "https://apachephptest:80" ]
8282
interval: 30s
@@ -92,4 +92,4 @@ services:
9292
image: nginx:1.25.4
9393
container_name: afup-web-static
9494
volumes:
95-
- ./.docker/data/test/static-resources:/usr/share/nginx/html:ro
95+
- ./docker/data/test/static-resources:/usr/share/nginx/html:ro

doc/dev-setup.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ Il faut se connecter au container via `make console` puis :
9999
./bin/behat
100100
```
101101

102+
ou
103+
104+
```bash
105+
make behat
106+
```
107+
102108
> [!TIP]
103109
> Il est possible de spécifier un test dans la ligne de commande :
104110
> ```bash
@@ -119,15 +125,15 @@ Si par la suite, vous souhaitez lancer un test, il faut bien penser à les allum
119125
Les tests unitaires sont écrits via PHPUnit.
120126

121127
```bash
122-
bash unit-test
128+
make unit-test
123129
```
124130

125131
### Tests d'intégration
126132

127133
Ces tests sont écrits via PHPUnit et utilisent le kernel de Symfony : https://symfony.com/doc/current/testing.html#integration-tests
128134

129135
```bash
130-
bash test-integration
136+
make test-integration
131137
```
132138

133139
Une alternative est d'utiliser la commande `make test-integration`, attention cette commande arrête les containeurs de

docker/apachephp/Dockerfile

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
FROM php:8.2-apache AS afup_web_base
2+
3+
ARG UID=1008
4+
ARG GID=1008
5+
6+
WORKDIR /var/www/html
7+
8+
# Update package list and install system dependencies
9+
RUN apt-get update \
10+
&& apt-get install -y --no-install-recommends \
11+
acl \
12+
git \
13+
file \
14+
gettext \
15+
gosu; \
16+
rm -rf /var/lib/apt/lists/*; \
17+
# verify that the binary works
18+
gosu nobody true;
19+
20+
RUN groupadd -g ${GID} localUser && \
21+
useradd -l -u ${UID} -g ${GID} -m -s /bin/bash localUser && \
22+
usermod -a -G www-data localUser
23+
24+
ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
25+
26+
RUN set -eux; \
27+
install-php-extensions @composer-2.2.25 zip intl pdo_mysql mysqli gd opcache pcntl \
28+
;
29+
30+
COPY --link php/conf.d/10-app.ini $PHP_INI_DIR/conf.d/
31+
32+
COPY --link --chmod=755 php/docker-healthcheck.sh /usr/local/bin/docker-healthcheck
33+
HEALTHCHECK --start-period=1m CMD docker-healthcheck
34+
35+
COPY --link --chmod=755 php/docker-entrypoint.sh /usr/local/bin/docker-entrypoint
36+
37+
ENTRYPOINT ["docker-entrypoint"]
38+
CMD ["apache2-foreground"]
39+
40+
FROM afup_web_base AS afup_web_dev
41+
42+
COPY --link php/conf.d/20-app.dev.ini $PHP_INI_DIR/conf.d/
43+
44+
RUN set -eux; \
45+
install-php-extensions xdebug \
46+
;
47+
48+
COPY --link apache/apache.conf /etc/apache2/sites-available/000-default.conf
49+
COPY --link apache/cert/apache.crt /etc/apache2/ssl/apache.crt
50+
COPY --link apache/cert/apache.key /etc/apache2/ssl/apache.key
51+
52+
RUN sed --in-place "s/User \${APACHE_RUN_USER}/User localUser/" /etc/apache2/apache2.conf && \
53+
sed --in-place "s/Group \${APACHE_RUN_GROUP}/Group localUser/" /etc/apache2/apache2.conf && \
54+
a2ensite 000-default && \
55+
a2enmod rewrite ssl

0 commit comments

Comments
 (0)