diff --git a/Dockerfile b/Dockerfile index 9d13a08..d47cd83 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,13 +12,17 @@ WORKDIR /var/www COPY . . # install dependencies +RUN rm -rf vendor 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 +RUN mv vendor ../docker-vendor +RUN echo 'mv /var/www/vendor /var/current-vendor 2>/dev/null || : && \ + mv /var/docker-vendor /var/www/vendor && \ + /bin/sh -c "$@" || : && \ + mv /var/www/vendor /var/docker-vendor && \ + mv /var/current-vendor /var/www/vendor 2>/dev/null || :' > /etc/run.sh ENTRYPOINT ["/bin/sh", "/etc/run.sh"] CMD ["vendor/bin/phpunit"] diff --git a/makefile b/makefile index 1c40be7..a37c9ef 100644 --- a/makefile +++ b/makefile @@ -3,3 +3,10 @@ docs: chmod +x apigen.phar php apigen.phar generate --source=src --destination=docs --template-theme=bootstrap rm apigen.phar + +image: + docker build -t matthiasmullie/minify . + +test: + [ ! -z `docker images -q matthiasmullie/minify` ] || make image + docker run --rm --name minify -v `pwd`:/var/www matthiasmullie/minify vendor/bin/phpunit