Skip to content
Open
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
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM ubuntu:16.04

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
curl git zip php php-dom php-curl php-common php-xdebug\
&& apt-get clean

# * * * * * * * * * install composer
RUN curl --silent --show-error https://getcomposer.org/installer | php && mv /composer.phar /usr/local/bin/composer

# * * * * * * * * * clean up
RUN rm -r /var/lib/apt/lists/*

ADD . /app

WORKDIR /app

RUN composer install

CMD ["vendor/bin/phpunit"]
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,16 @@ Run the tests
```
./vendor/bin/phpunit
```

## Use Docker for testing
We provide a Dockerfile with Ubuntu 16.04 and PHP7
Start testing via the following:
```
docker build -t sofortlib .
docker run -ti -v $(pwd):/app sofortlib bash -c "composer install && vendor/bin/phpunit"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docker run sofortlib sould be sufficient here as you add the lib on build time, correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could run it like that to have all tests run, correct. But think about someone who'd like to somehow "interact" with the code... you run unit tests by building the container, that should be quite sufficient to run it afterwards and edit files.
But by mounting your files into the container, you could simply use it e.g. for development reasons

```

## Use Docker to run examples
```
docker run -ti -v $(pwd):/app sofortlib bash -c "php examples/Paycode.php"
```