Skip to content

Commit 74d85f8

Browse files
committed
chore: improve docker tests
1 parent 7dab675 commit 74d85f8

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

Dockerfile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
ARG PHP_VERSION=8.0
2-
ARG COMPOSER_VERSION=2.0
1+
ARG PHP_VERSION=8.1
2+
ARG COMPOSER_VERSION=2.5.4
33

44
FROM composer:${COMPOSER_VERSION}
55
FROM php:${PHP_VERSION}-cli
@@ -13,3 +13,9 @@ RUN apt-get update && \
1313
COPY --from=composer /usr/bin/composer /usr/local/bin/composer
1414

1515
WORKDIR /code
16+
17+
COPY . .
18+
19+
RUN composer install
20+
21+
CMD ["./vendor/bin/phpunit"]

docker-compose.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ version: '3'
33
services:
44
tests:
55
container_name: tests
6+
#platform: linux/arm64
7+
tty: true
68
build:
79
context: .
810
dockerfile: Dockerfile
@@ -15,9 +17,10 @@ services:
1517

1618
mysql:
1719
container_name: mysql
18-
image: mysql:5.7
20+
#platform: linux/arm64
21+
image: mysql:8.0
1922
ports:
20-
- 3306:3306
23+
- "3306:3306"
2124
environment:
2225
MYSQL_ROOT_PASSWORD:
2326
MYSQL_DATABASE: unittest
@@ -27,8 +30,7 @@ services:
2730

2831
mongodb:
2932
container_name: mongodb
30-
image: mongo
33+
#platform: linux/arm64
34+
image: mongo:latest
3135
ports:
32-
- 27017:27017
33-
logging:
34-
driver: none
36+
- "27017:27017"

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
</testsuite>
3939
</testsuites>
4040
<php>
41-
<env name="MONGODB_URI" value="mongodb://127.0.0.1/" />
41+
<env name="MONGODB_URI" value="mongodb://mongodb/" />
4242
<env name="MONGODB_DATABASE" value="unittest"/>
4343
<env name="MYSQL_HOST" value="mysql"/>
4444
<env name="MYSQL_PORT" value="3306"/>

0 commit comments

Comments
 (0)