Skip to content

chore: improve docker tests #2514

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
ARG PHP_VERSION=8.0
ARG COMPOSER_VERSION=2.0
ARG PHP_VERSION=8.1
ARG COMPOSER_VERSION=2.5.4

FROM composer:${COMPOSER_VERSION}
FROM php:${PHP_VERSION}-cli

RUN apt-get update && \
Expand All @@ -10,6 +9,16 @@ RUN apt-get update && \
pecl install xdebug && docker-php-ext-enable xdebug && \
docker-php-ext-install -j$(nproc) pdo_mysql zip

COPY --from=composer /usr/bin/composer /usr/local/bin/composer
COPY --from=composer:${COMPOSER_VERSION} /usr/bin/composer /usr/local/bin/composer

WORKDIR /code

COPY composer.* ./

RUN composer install

COPY ./ ./

RUN composer install

CMD ["./vendor/bin/phpunit"]
13 changes: 5 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ version: '3'
services:
tests:
container_name: tests
tty: true
build:
context: .
dockerfile: Dockerfile
Expand All @@ -15,20 +16,16 @@ services:

mysql:
container_name: mysql
image: mysql:5.7
image: mysql:8.0
ports:
- 3306:3306
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD:
MYSQL_DATABASE: unittest
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
logging:
driver: none

mongodb:
container_name: mongodb
image: mongo
image: mongo:latest
ports:
- 27017:27017
logging:
driver: none
- "27017:27017"
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
</testsuite>
</testsuites>
<php>
<env name="MONGODB_URI" value="mongodb://127.0.0.1/" />
<env name="MONGODB_URI" value="mongodb://mongodb/" />
<env name="MONGODB_DATABASE" value="unittest"/>
<env name="MYSQL_HOST" value="mysql"/>
<env name="MYSQL_PORT" value="3306"/>
Expand Down