mirror of
https://github.com/wiosna-dev/common-library.git
synced 2026-03-12 01:31:45 +01:00
Tests - use Docker (as environment guard)
This commit is contained in:
42
.docker/config/Dockerfile
Normal file
42
.docker/config/Dockerfile
Normal file
@@ -0,0 +1,42 @@
|
||||
FROM php:5.6-cli
|
||||
|
||||
#
|
||||
# Tools & libraries
|
||||
#
|
||||
RUN apt-get update && apt-get install -y \
|
||||
libicu-dev
|
||||
|
||||
#
|
||||
# PHP Extensions
|
||||
#
|
||||
RUN docker-php-ext-install \
|
||||
intl
|
||||
|
||||
#
|
||||
# Timezone
|
||||
#
|
||||
ARG TIMEZONE
|
||||
RUN echo "date.timezone = $TIMEZONE" >> /usr/local/etc/php/php.ini
|
||||
|
||||
#
|
||||
# Xdebug
|
||||
#
|
||||
RUN pecl install xdebug \
|
||||
&& docker-php-ext-enable xdebug
|
||||
COPY xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
|
||||
|
||||
#
|
||||
# Phing
|
||||
#
|
||||
RUN pear channel-discover pear.phing.info \
|
||||
&& pear install [--alldeps] phing/phing
|
||||
|
||||
#
|
||||
# Composer
|
||||
#
|
||||
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
|
||||
&& php -r "if (hash_file('SHA384', 'composer-setup.php') === \
|
||||
'544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo \
|
||||
'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \
|
||||
&& php composer-setup.php --install-dir=/usr/local/bin --filename=composer \
|
||||
&& php -r "unlink('composer-setup.php');"
|
||||
7
.docker/config/xdebug.ini
Normal file
7
.docker/config/xdebug.ini
Normal file
@@ -0,0 +1,7 @@
|
||||
[xdebug]
|
||||
zend_extension='xdebug.so'
|
||||
|
||||
xdebug.remote_enable=1
|
||||
xdebug.remote_connect_back=1
|
||||
xdebug.idekey='PHPSTORM'
|
||||
xdebug.remote_port=9001
|
||||
@@ -13,6 +13,15 @@ $ composer require meritoo/common-library
|
||||
|
||||
> How to install Composer: https://getcomposer.org/download
|
||||
|
||||
## Rebuilding project and tests running
|
||||
|
||||
```bash
|
||||
$ docker-compose up -d
|
||||
$ docker-compose exec php-cli phing
|
||||
```
|
||||
|
||||
> What is Docker? https://www.docker.com/what-docker
|
||||
|
||||
## Static methods
|
||||
|
||||
This package contains a lot of class with static methods, so usage is not so complicated. Just run the static method who would you like to use. Example:
|
||||
|
||||
15
docker-compose.yml
Normal file
15
docker-compose.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
php-cli:
|
||||
image: php-cli
|
||||
container_name: php-cli
|
||||
working_dir: /project
|
||||
entrypoint: php
|
||||
command: -S 0.0.0.0:99
|
||||
build:
|
||||
context: ./.docker/config
|
||||
args:
|
||||
- TIMEZONE=$TIMEZONE
|
||||
volumes:
|
||||
- .:/project
|
||||
Reference in New Issue
Block a user