xref: /php-ast/ci/test_dockerized.sh (revision 6b05823e)
1#!/usr/bin/env bash
2if [ $# != 1 ]; then
3    echo "Usage: $0 PHP_VERSION" 1>&2
4    echo "e.g. $0 8.0 or $0 8.0-alpine" 1>&2
5    echo "The PHP_VERSION is the version of the php docker image to use" 1>&2
6    exit 1
7fi
8# -x Exit immediately if any command fails
9# -e Echo all commands being executed.
10# -u fail for undefined variables
11set -xeu
12PHP_VERSION=$1
13# uppercase is not allowed in image names, only in tags
14DOCKER_IMAGE=php-ast-test-runner:$PHP_VERSION
15docker build --build-arg="PHP_VERSION=$PHP_VERSION" --tag="$DOCKER_IMAGE" -f ci/Dockerfile .
16docker run --rm $DOCKER_IMAGE ci/test_inner.sh
17