diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..61ead86 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +/vendor diff --git a/.gitattributes b/.gitattributes index 132468b..001a19c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,8 +1,9 @@ +/.dockerignore export-ignore /.gitattributes export-ignore +/.github /.gitignore export-ignore +/Dockerfile export-ignore /phpcs.xml.dist export-ignore /phpmd.xml export-ignore /phpunit.xml.dist export-ignore -/puppet export-ignore /test export-ignore -/Vagrantfile export-ignore diff --git a/.gitignore b/.gitignore index 7bef0bc..61ead86 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -/.vagrant /vendor diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0459d68 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM php:7.4-cli-alpine + +ENV COMPOSER_CACHE_DIR /tmp + +RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \ + && php composer-setup.php --install-dir /usr/bin --filename composer \ + && php -r "unlink('composer-setup.php');" \ + && docker-php-source delete \ + && apk add unzip + +VOLUME /app + +WORKDIR /app diff --git a/README.md b/README.md index cba0337..26a36cc 100644 --- a/README.md +++ b/README.md @@ -138,6 +138,25 @@ $filter = new IntToRoman(); $result = $filter->filter(0); // N ``` +## Development + +You can use Docker to build an image and run a container to develop and test +this package. + +```bash +docker build . --tag wandersonwhcr/romans + +docker run --rm --interactive --tty \ + --volume `pwd`:/app \ + --user `id -u`:`id -g` \ + wandersonwhcr/romans composer install + +docker run --rm --interactive --tty \ + --volume `pwd`:/app \ + --user `id -u`:`id -g` \ + wandersonwhcr/romans composer test +``` + ## Techniques This section describes some techniques this package uses to convert Roman diff --git a/Vagrantfile b/Vagrantfile deleted file mode 100644 index 0358559..0000000 --- a/Vagrantfile +++ /dev/null @@ -1,9 +0,0 @@ -Vagrant.configure(2) do |config| - config.vm.box = "puppetlabs/debian-8.2-32-puppet" - - config.vm.provision 'puppet' do |puppet| - puppet.options = "--verbose --debug" - puppet.environment = "develop" - puppet.environment_path = "puppet/environments" - end -end diff --git a/puppet/environments/develop/manifests/default.pp b/puppet/environments/develop/manifests/default.pp deleted file mode 100644 index bc85e58..0000000 --- a/puppet/environments/develop/manifests/default.pp +++ /dev/null @@ -1,73 +0,0 @@ -Exec { - path => ["/usr/bin", "/bin", "/usr/sbin", "/sbin"], - timeout => 0, -} - -Package { - require => Exec["apt-get : update"], - before => Exec["apt-get : autoremove"], -} - -exec { "apt-get : update": - command => "apt-get update", -} - -exec { "apt-get : autoremove": - command => "apt-get autoremove -q -y", -} - -exec { "apt-get : https-update": - command => "apt-get update", -} - -package { "apt-get : https": - name => "apt-transport-https", - require => Exec["apt-get : https-update"], -} - -package { "vim": - name => "vim", -} - -package { "git": - name => "git", -} - -package { "unzip": - name => "unzip", -} - -exec { "php : key": - creates => "/etc/apt/trusted.gpg.d/php.gpg", - command => "wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg", -} - -file { "php : list": - path => "/etc/apt/sources.list.d/php.list", - content => "deb https://packages.sury.org/php/ jessie main", - require => Exec["php : key"], - before => Exec["apt-get : update"], -} - -package { "php : cli": - name => "php-cli", - require => [ - File["php : list"], - Exec["apt-get : update"], - ], -} - -package { "php : xml": - name => "php-xml", - require => Package["php : cli"], -} - -package { "php : mbstring": - name => "php-mbstring", - require => Package["php : cli"], -} - -exec { "composer": - creates => "/usr/bin/composer", - command => "curl https://getcomposer.org/composer.phar -o /usr/bin/composer && chmod +x /usr/bin/composer", -}