diff --git a/.docker/config/Dockerfile b/.docker/config/Dockerfile new file mode 100644 index 0000000..0c157ad --- /dev/null +++ b/.docker/config/Dockerfile @@ -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');" diff --git a/.docker/config/xdebug.ini b/.docker/config/xdebug.ini new file mode 100644 index 0000000..acd3d8c --- /dev/null +++ b/.docker/config/xdebug.ini @@ -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 diff --git a/.env b/.env new file mode 100644 index 0000000..c6eb126 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +TIMEZONE=Europe/Warsaw diff --git a/README.md b/README.md index 81f7a40..057ead4 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..227583b --- /dev/null +++ b/docker-compose.yml @@ -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