diff --git a/.travis.yml b/.travis.yml index 0ab847d0..f7b619b9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -56,23 +56,18 @@ matrix: env: - DEPS=latest - MONGO_DRIVER=mongodb - - PHP_VERSION=7.1 - - DOCKER=true - php: 7.2 env: - DEPS=lowest - MONGO_DRIVER=mongodb - - DOCKER=true - php: 7.2 env: - DEPS=locked - MONGO_DRIVER=mongodb - - DOCKER=true - php: 7.2 env: - DEPS=latest - MONGO_DRIVER=mongodb - - DOCKER=true before_install: - if [[ $TEST_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi @@ -91,7 +86,7 @@ install: script: - if [[ $TEST_COVERAGE == 'true' ]]; then composer test-coverage ; else composer test ; fi - if [[ $CS_CHECK == 'true' ]]; then composer cs-check ; fi - - if [[ $DOCKER == 'true' ]]; then docker exec -it $(docker ps -f name=zfapigilitydoctrine_php_1 | awk '{print $1;}' | tail -n 1) bash /docker/.travis.docker; fi + - docker-compose run --rm php after_script: - if [[ $TEST_COVERAGE == 'true' ]]; then travis_retry php vendor/bin/php-coveralls -v ; fi diff --git a/DOCKER.md b/DOCKER.md index 72e1379c..72955c39 100644 --- a/DOCKER.md +++ b/DOCKER.md @@ -15,19 +15,12 @@ From the root directory of this project run docker-compose build ``` -This will build the php container. Next run +This will build the php container. -``` -docker-compose up -``` - -This will spin up the php container and a mongo container. - -To connect to the php container and run the unit tests -run +To connect to the php container and run the unit tests run ``` -docker-compose run php bash +docker-compose run --rm php bash ``` You will connect to the php container a the root directory. @@ -36,7 +29,15 @@ You will connect to the php container a the root directory. ## Unit Tests Having run `composer install` you may now run the unit tests +inside the container with ``` vendor/bin/phpunit ``` + +You may run the unit tests through the container without connecting +with bash via + +``` +docker-composer run --rm php +``` diff --git a/docker/Dockerfile b/Dockerfile similarity index 62% rename from docker/Dockerfile rename to Dockerfile index 13c8d0a3..126ac964 100644 --- a/docker/Dockerfile +++ b/Dockerfile @@ -5,20 +5,17 @@ RUN apk add --no-cache \ autoconf \ make \ g++ \ - bash + bash \ + git \ + openssl-dev -RUN pecl install mongodb && docker-php-ext-enable mongodb +RUN echo "memory_limit=2G" >> /usr/local/etc/php/php.ini +RUN if [ ${PHP_VERSION:0:3} == "5.6" ] ; then pecl install mongo && echo "extension=mongo.so" >> /usr/local/etc/php/php.ini ; else pecl install mongodb && docker-php-ext-enable mongodb ; fi RUN set -o pipefail && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer -RUN echo -e '#!/bin/sh' > /usr/local/bin/entrypoint.sh \ +RUN echo -e '#!/bin/sh ' > /usr/local/bin/entrypoint.sh \ && echo -e 'while ! nc -z ${MONGO_HOST:-mongo} ${MONGO_PORT:-27017}; do sleep 1; done' >> /usr/local/bin/entrypoint.sh \ && echo -e 'exec "$@"' >> /usr/local/bin/entrypoint.sh \ && chmod +x /usr/local/bin/entrypoint.sh WORKDIR /docker ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] CMD ["./vendor/bin/phpunit"] - -# RUN apt-get update -# RUN apt-get --yes install vim -# RUN apt-get --yes install git -# RUN apt-get --yes install inetutils-ping -# RUN apt-get --yes install host diff --git a/docker-compose.yml b/docker-compose.yml index cf757006..8fbd1b3a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,8 +4,8 @@ services: build: context: . args: - - PHP_VERSION=${PHP_VERSION:-7.2} - dockerfile: docker/Dockerfile + - PHP_VERSION=${TRAVIS_PHP_VERSION:-7.2} + dockerfile: Dockerfile depends_on: - mongo volumes: diff --git a/docker/connect b/docker/connect deleted file mode 100755 index 1fcf5c2b..00000000 --- a/docker/connect +++ /dev/null @@ -1 +0,0 @@ -docker exec -it $(docker ps -f name=zfapigilitydoctrine_php_1 | awk '{print $1;}' | tail -n 1) bash diff --git a/docker/data/.gitkeep b/docker/data/.gitkeep deleted file mode 100644 index e69de29b..00000000