Skip to content

Instantly share code, notes, and snippets.

@alex-georgiou
Last active April 5, 2016 09:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alex-georgiou/f7a5c870014f7792d780609790e99d11 to your computer and use it in GitHub Desktop.
Save alex-georgiou/f7a5c870014f7792d780609790e99d11 to your computer and use it in GitHub Desktop.
Run `grunt phpunit` against your project on PHP versions 5.3 through 5.6
# Run `grunt phpunit` against your project on PHP versions 5.3 through 5.6
# Assumes a Gruntfile.js with working phpunit task
# Based on http://blog.eriksen.com.br/en/docker-image-multi-version-php-development
#
# Copy this Dockerfile into your project. Build the image with:
#
# docker build -t alexg/php-x-test:1.0 -t alexg/php-x-test:latest .
#
# Run your tests with:
#
# docker run -t alexg/php-x-test
FROM eriksencosta/php-dev:latest
MAINTAINER Alexandros Georgiou <alex.georgiou@gmail.com>
LABEL Description="Run `grunt phpunit` against your project on PHP versions 5.3 through 5.6" Version="1.0"
# Adds your project from the current directory.
# Consider excluding `.git` and `node_modules` in your `.dockerignore` file for an even more lightweight container
ADD . /root
WORKDIR /root
# Installs latest node, npm and your grunt dependencies
RUN \
curl -sL https://deb.nodesource.com/setup | bash - && \
apt-get install -y nodejs npm && \
npm install && \
npm install -g grunt-cli
# This path is needed to run phpenv and phpunit and stuff
ENV PATH /opt/phpenv/shims:/opt/phpenv/bin:/opt/php-build/bin/:/opt/composer/vendor/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# The command that runs the tests
CMD for ver in 5.6 5.5 5.4 5.3; do phpenv global $ver; grunt phpunit; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment