Add files to run php73 tests inside a docker container

This commit is contained in:
Zach Borboa
2018-12-09 21:39:38 -08:00
parent e75a4c5525
commit 39eba1dfa4
6 changed files with 72 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
# Build an image.
docker build --tag="php-curl-class/php73" .
+15
View File
@@ -0,0 +1,15 @@
# Run image to create container.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
set -x
cd "${SCRIPT_DIR}/../../.."
project_dir="${PWD}"
docker start "php73" ||
docker run \
--detach \
--interactive \
--mount "type=bind,src=${project_dir},dst=/data,readonly=true" \
--name="php73" \
--tty \
"php-curl-class/php73"
+17
View File
@@ -0,0 +1,17 @@
# Run tests inside container.
command=$(cat <<-END
mkdir --parents "/tmp/php-curl-class" &&
rsync --delete --exclude=".git" --exclude="vendor" --links --recursive "/data/" "/tmp/php-curl-class/" &&
cd "/tmp/php-curl-class" &&
export TRAVIS_PHP_VERSION="7.3" &&
(
[ ! -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 "php73" sh -c "${command}"
+3
View File
@@ -0,0 +1,3 @@
# Stop container.
docker stop "php73"
+21
View File
@@ -0,0 +1,21 @@
# TODO: Change to php:7.3-cli when available.
# -FROM php:7.3-rc-cli
# +FROM php:7.3-cli
FROM php:7.3-rc-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"]
+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="php73" \
--rm \
--tty \
"php-curl-class/php73" /bin/bash