Add files to run php56 tests inside a docker container

This commit is contained in:
Zach Borboa
2018-07-28 22:44:01 -07:00
parent 26e6a966df
commit 7edaee784d
4 changed files with 51 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
# Build an image.
docker build --tag="php-curl-class/php56" .
+14
View File
@@ -0,0 +1,14 @@
# Run image to create container and attach to it.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
set -x
cd "${SCRIPT_DIR}/../../.."
project_dir="${PWD}"
docker run \
--interactive \
--mount "type=bind,src=${project_dir},dst=/data,readonly=true" \
--name=php56 \
--rm \
--tty \
"php-curl-class/php56" /bin/bash
+17
View File
@@ -0,0 +1,17 @@
# Run tests inside container.
command=$(cat <<-END
mkdir --parents "/tmp/php-curl-class" &&
rsync --exclude=".git" --exclude="vendor" --links --recursive "/data/" "/tmp/php-curl-class/" &&
cd "/tmp/php-curl-class" &&
export TRAVIS_PHP_VERSION="5.6" &&
(
[ ! -f "/tmp/.composer_updated" ] &&
composer --no-interaction update &&
touch "/tmp/.composer_updated" ||
exit 0
) &&
bash "tests/before_script.sh" &&
bash "tests/script.sh"
END
)
docker exec --interactive --tty "php56" sh -c "${command}"
+18
View File
@@ -0,0 +1,18 @@
FROM php:5.6-cli
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get --assume-yes --quiet update
RUN apt-get --assume-yes --quiet install git && \
apt-get --assume-yes --quiet install libpng-dev && \
apt-get --assume-yes --quiet install zip
RUN curl --silent --show-error "https://getcomposer.org/installer" | php && \
mv "composer.phar" "/usr/local/bin/composer" && \
composer global require --no-interaction "phpunit/phpunit"
RUN docker-php-ext-configure gd && \
docker-php-ext-install gd
ENV PATH /root/.composer/vendor/bin:$PATH
CMD ["bash"]