Skip to content

Commit

Permalink
Add Dockerfile for quick and easy testing
Browse files Browse the repository at this point in the history
Not that it's hard to set up an environment to test
this library in, but perhaps you just can't be bothered
to mess up your system installing software and versions
you don't otherwise need.

Build the image:
$ docker build -t minify .

Run the tests:
$ docker run --rm --name minify minify

Or if you plan on testing/changing the code and don't
want to rebuild the image, just load it as a volume:
$ docker run --rm --name minify -v ~/Sites/minify:/var/www minify
  • Loading branch information
matthiasmullie committed Sep 21, 2017
1 parent 358a273 commit fa0b1d4
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM php:cli

# install composer and a bunch of dependencies
RUN apt-get update && apt-get install -y git curl zip unzip zlib1g-dev
RUN docker-php-ext-install zip
RUN docker-php-ext-install pcntl
RUN curl -sS https://getcomposer.org/installer | php
RUN mv composer.phar /usr/local/bin/composer

# pull in code
WORKDIR /var/www
COPY . .

# install dependencies
RUN composer install

# to support loading the directory as volume, we'll move vendor out of the way so it
# doesn't get overwritten by more recent code; we'll put it back before running anything
RUN mv vendor ../vendor
RUN echo 'cp -r /var/vendor /var/www/vendor && exec "$@"' > /etc/run.sh
RUN chmod +x /etc/run.sh
ENTRYPOINT ["/bin/sh", "/etc/run.sh"]

CMD ["vendor/bin/phpunit"]

0 comments on commit fa0b1d4

Please sign in to comment.