Skip to content

Commit ae7b1a9

Browse files
committed
🐳 New travis docker setup
1 parent bdb15c9 commit ae7b1a9

File tree

4 files changed

+31
-24
lines changed

4 files changed

+31
-24
lines changed

.travis.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,27 @@
1-
sudo: required
2-
dist: trusty
3-
language: php
4-
php:
5-
- "7.2"
6-
- "7.1"
1+
language: minimal
2+
3+
matrix:
4+
include:
5+
- name: "7.1"
6+
env: PHP_VERSION=7.1
7+
- name: "7.2"
8+
env: PHP_VERSION=7.2
9+
- name: "7.3"
10+
env: PHP_VERSION=7.3
711

812
services:
913
- docker
1014

15+
cache:
16+
directories:
17+
- $HOME/.composer/cache
18+
1119
install:
1220
- docker version
1321
- sudo pip install docker-compose
1422
- docker-compose version
15-
- cat Dockerfile
16-
- docker-compose build --build-arg PHP_VERSION=${TRAVIS_PHP_VERSION}
23+
- docker-compose build --build-arg PHP_VERSION=${PHP_VERSION}
24+
- docker-compose run --rm tests composer install --no-interaction
1725

1826
script:
19-
- docker-compose up --exit-code-from php
27+
- docker-compose run --rm tests ./vendor/bin/phpunit --coverage-clover ./clover.xml

Dockerfile

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
ARG PHP_VERSION=7.2
2+
ARG COMPOSER_VERSION=1.8
23

4+
FROM composer:${COMPOSER_VERSION}
35
FROM php:${PHP_VERSION}-cli
46

5-
RUN pecl install xdebug
6-
77
RUN apt-get update && \
8-
apt-get install -y autoconf pkg-config libssl-dev git zlib1g-dev
9-
10-
RUN pecl install mongodb && docker-php-ext-enable mongodb && \
11-
docker-php-ext-install -j$(nproc) pdo pdo_mysql zip && docker-php-ext-enable xdebug
8+
apt-get install -y autoconf pkg-config libssl-dev git libzip-dev zlib1g-dev && \
9+
pecl install mongodb && docker-php-ext-enable mongodb && \
10+
pecl install xdebug && docker-php-ext-enable xdebug && \
11+
docker-php-ext-install -j$(nproc) pdo_mysql zip
1212

13-
RUN curl -sS https://getcomposer.org/installer | php \
14-
&& mv composer.phar /usr/local/bin/ \
15-
&& ln -s /usr/local/bin/composer.phar /usr/local/bin/composer
13+
COPY --from=composer /usr/bin/composer /usr/local/bin/composer
1614

17-
ENV PATH="~/.composer/vendor/bin:./vendor/bin:${PATH}"
15+
WORKDIR /code

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"illuminate/container": "^5.8",
1616
"illuminate/database": "^5.8",
1717
"illuminate/events": "^5.8",
18-
"mongodb/mongodb": "^1.0.0"
18+
"mongodb/mongodb": "^1.0"
1919
},
2020
"require-dev": {
2121
"phpunit/phpunit": "^6.0|^7.0",

docker-compose.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
version: '3'
22

33
services:
4-
php:
5-
container_name: php
4+
tests:
5+
container_name: tests
66
build:
77
context: .
88
dockerfile: Dockerfile
99
volumes:
1010
- .:/code
1111
working_dir: /code
12-
command: bash -c "composer install --prefer-source --no-interaction && php ./vendor/bin/phpunit"
1312
depends_on:
14-
- mysql
1513
- mongodb
14+
- mysql
1615

1716
mysql:
1817
container_name: mysql
@@ -27,5 +26,7 @@ services:
2726
mongodb:
2827
container_name: mongodb
2928
image: mongo
29+
ports:
30+
- 27017:27017
3031
logging:
3132
driver: none

0 commit comments

Comments
 (0)