Add docker helpers to makefile

This commit is contained in:
Matthias Mullie 2017-09-21 19:12:16 +02:00
parent 11a1520dbb
commit c2f929c3d9
2 changed files with 14 additions and 3 deletions

View File

@ -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"]

View File

@ -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