Skip to content

Commit

Permalink
Merge pull request #305 from alexislefebvre/chore-do-not-use-php-fpm
Browse files Browse the repository at this point in the history
chore: don't use fpm in Docker
  • Loading branch information
alexislefebvre authored Apr 14, 2024
2 parents 53dc42e + 29bbdee commit 17124fe
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.3-fpm
FROM php:8.3-cli-bookworm
WORKDIR "/application"

RUN apt-get update \
Expand All @@ -20,3 +20,5 @@ RUN apt-get update \
&& rm -rf mongodb-database-tools-*.deb /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*

COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer

CMD ["/bin/sh", "-ec", "sleep infinity"]
14 changes: 7 additions & 7 deletions doc/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,45 +15,45 @@ docker-compose up --detach
Install the dependencies with composer:

```bash
docker-compose exec php-fpm composer install
docker-compose exec php composer install
```

Install the lowest dependencies with composer:

```bash
docker-compose exec php-fpm composer update --prefer-lowest
docker-compose exec php composer update --prefer-lowest
```

Now you can execute the tests with the following command:

```bash
docker-compose exec php-fpm ./vendor/bin/phpunit --process-isolation
docker-compose exec php ./vendor/bin/phpunit --process-isolation
```

If one test fails, run it without the `--process-isolation` option

```bash
docker-compose exec php-fpm ./vendor/bin/phpunit tests/Test/ConfigMongodbTest.php
docker-compose exec php ./vendor/bin/phpunit tests/Test/ConfigMongodbTest.php
```

You can also use the `--filter` option to run tests matching a class and name:

```bash
docker-compose exec php-fpm ./vendor/bin/phpunit --process-isolation --filter=ConfigSqliteTest::testAppendFixtures
docker-compose exec php ./vendor/bin/phpunit --process-isolation --filter=ConfigSqliteTest::testAppendFixtures
```

You can also use the `--filter` option to run tests matching a name:

```bash
docker-compose exec php-fpm ./vendor/bin/phpunit --process-isolation --filter=testAppendFixtures
docker-compose exec php ./vendor/bin/phpunit --process-isolation --filter=testAppendFixtures
```

## Delete the cache

If you change the version of PHP or dependencies, the caches may cause issues, they can be deleted:

```bash
docker-compose exec php-fpm bash -c "rm -rf tests/App*/var/cache/*"
docker-compose exec php bash -c "rm -rf tests/App*/var/cache/*"
```

## Apply changes suggested by PHP-CS-Fixer
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ services:
ports:
- '11004:5432'

php-fpm:
php:
build: .
working_dir: /application
volumes:
Expand Down

0 comments on commit 17124fe

Please sign in to comment.