Merge pull request #56 from mlocati/alpine

Add Alpine support
pull/57/head
Michele Locati 2019-12-11 23:20:28 +01:00 committed by GitHub
commit 989d5d8a0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 684 additions and 307 deletions

View File

@ -1,5 +1,8 @@
sudo: false sudo: false
notifications:
email: false
branches: branches:
only: only:
- master - master
@ -7,16 +10,24 @@ branches:
services: services:
- docker - docker
test-extensions-job-template: &test-extensions-job-template
stage: Test extensions
if: type = pull_request
script: ./scripts/travisci-test-extensions
jobs:
include:
- <<: *test-extensions-job-template
name: Test extensions on Alpine Linux
env: DOCKER_DISTRO=alpine
- <<: *test-extensions-job-template
name: Test extensions on Debian Linux
env: DOCKER_DISTRO=debian
- stage: Update docs
name: Update README.md
if: branch = master AND type = push
env: env:
global:
- secure: "vsl8z41oBky/MDRDKqs74Bif6BJldCPFVdl2lbPcjehOYG5cZ4YRLIEuhgJfnOglCGdyY6gh/2umSowRI4r5mC/ZR42RKJzWj9xQX2usJbzeOeZj+5eQv5im1DVwRmigUMzQOS743bd/zEeR9J3MLMgTGhKWEPKOJI6CHseUIKazAc0Z8vH6055YtkhGMqnolOe9h0gJx/sLP18qo2LTw82SyjOAMfbyYuHpiLznAqIOpNtwyj9WAujE3qN2oCo+9ALOnnrlINPqeLjnIOxRcSgYO4wIGPGSXIDTquuUht0McszOLuC9/kc6RybcyxmcqsssYRK2y0DQuavzyja5UaB4Pzf2vMrlbozAxdtF3oadZzfsAYfbhzaLbx0g1aAzL1CTJvXrWkZQgiy2c7tboXKJ3SvOqDp+GXEw08kCTpUq1AYSLw8ExlqcWZGiQxJfnfA05fWOkf8xM38ZQ+LPUHyGrt+PIw8FPAGhOV4E+BmHUlOoXOwoNllCEJ4QNkwxYT90eAMS5Rw8q6KASedwDFwyPCv8VtpNEtsl/FVa3m8/6wA7QmtuPxg7E2wceSkzsqHEcGLzERb4DnhVfrW0wv8zRw92vsnBmZdxusBT5uuyp9h5asjj6YhhVJ52g2NdCAGJlobiPk5X4uifshcdlcS8vF/jBMpI03XyJU4V4xc=" - secure: "vsl8z41oBky/MDRDKqs74Bif6BJldCPFVdl2lbPcjehOYG5cZ4YRLIEuhgJfnOglCGdyY6gh/2umSowRI4r5mC/ZR42RKJzWj9xQX2usJbzeOeZj+5eQv5im1DVwRmigUMzQOS743bd/zEeR9J3MLMgTGhKWEPKOJI6CHseUIKazAc0Z8vH6055YtkhGMqnolOe9h0gJx/sLP18qo2LTw82SyjOAMfbyYuHpiLznAqIOpNtwyj9WAujE3qN2oCo+9ALOnnrlINPqeLjnIOxRcSgYO4wIGPGSXIDTquuUht0McszOLuC9/kc6RybcyxmcqsssYRK2y0DQuavzyja5UaB4Pzf2vMrlbozAxdtF3oadZzfsAYfbhzaLbx0g1aAzL1CTJvXrWkZQgiy2c7tboXKJ3SvOqDp+GXEw08kCTpUq1AYSLw8ExlqcWZGiQxJfnfA05fWOkf8xM38ZQ+LPUHyGrt+PIw8FPAGhOV4E+BmHUlOoXOwoNllCEJ4QNkwxYT90eAMS5Rw8q6KASedwDFwyPCv8VtpNEtsl/FVa3m8/6wA7QmtuPxg7E2wceSkzsqHEcGLzERb4DnhVfrW0wv8zRw92vsnBmZdxusBT5uuyp9h5asjj6YhhVJ52g2NdCAGJlobiPk5X4uifshcdlcS8vF/jBMpI03XyJU4V4xc="
script: ./scripts/travisci-update-readme
install:
- true
script:
- if test "${TRAVIS_EVENT_TYPE:-}" = 'pull_request'; then ./scripts/travisci-test-new-extensions; fi
- if test "${TRAVIS_EVENT_TYPE:-}" = 'push' && test "${TRAVIS_BRANCH:-}" = 'master'; then ./scripts/travisci-update-readme; fi
notifications:
email: false

View File

@ -4,10 +4,7 @@
This repository contains a script that can be used to easily install a PHP extension inside the [official PHP Docker images](https://hub.docker.com/_/php/). This repository contains a script that can be used to easily install a PHP extension inside the [official PHP Docker images](https://hub.docker.com/_/php/).
The script works both for Alpine and Debian Linux.
## Known limits
Currently the script requires the Debian-based images (no Alpine).
## Usage ## Usage
@ -33,11 +30,7 @@ COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr
RUN install-php-extensions gd xdebug RUN install-php-extensions gd xdebug
``` ```
`install-php-extensions` will install all the required APT packages. `install-php-extensions` will install all the required APT/APK packages; at the end of the script execution, the no-more needed packages will be removed.
If you want to remove the APT development packages (which shouldn't be needed after the PHP extensions have been installed) and other no longer required packages, you can use the `--cleanup` option (**EXPERIMENTAL**):
```
install-php-extensions --cleanup gd xdebug
```
## Supported PHP extensions ## Supported PHP extensions
@ -157,3 +150,16 @@ Some extension has special requirements:
Test: gd, zip Test: gd, zip
``` ```
If your pull request contains multiple commits, we'll check the "Test:" message of every commit.
If you want to stop parsing next commits, add `-STOP-` in the "Test:" line, for example:
```
Improve the GD and ZIP extensions
Test: gd, zip, -STOP-
```
## Do you want to really say thank you?
You can offer me a [monthly coffee](https://github.com/sponsors/mlocati) or a [one-time coffee](https://paypal.me/mlocati) :wink:

View File

@ -20,6 +20,7 @@ mcrypt 5.6 7.0 7.1 7.2 7.3 7.4
memcache 5.6 memcache 5.6
memcached 5.6 7.0 7.1 7.2 7.3 7.4 memcached 5.6 7.0 7.1 7.2 7.3 7.4
msgpack 5.6 7.0 7.1 7.2 7.3 7.4 msgpack 5.6 7.0 7.1 7.2 7.3 7.4
mssql 5.6
mysql 5.6 mysql 5.6
mysqli 5.6 7.0 7.1 7.2 7.3 7.4 mysqli 5.6 7.0 7.1 7.2 7.3 7.4
odbc 5.6 7.0 7.1 7.2 7.3 7.4 odbc 5.6 7.0 7.1 7.2 7.3 7.4

File diff suppressed because it is too large Load Diff

View File

@ -26,20 +26,28 @@ fi
# #
# Outputs: # Outputs:
# the full docker image ID # the full docker image ID
getExtensionImage () { getDockerImageName () {
case "${2}" in case "${2}" in
*) *)
getExtensionImage_version="${2}" getDockerImageName_version="${2}"
;; ;;
esac esac
getExtensionImage_result="php:${getExtensionImage_version}-cli" getDockerImageName_suffix='-cli'
getExtensionImage_reqs="${TRAVIS_BUILD_DIR}/data/special-requirements" getDockerImageName_reqs="${TRAVIS_BUILD_DIR}/data/special-requirements"
if test -f "${getExtensionImage_reqs}"; then if test -f "${getDockerImageName_reqs}"; then
if test -n "$(cat "${getExtensionImage_reqs}" | grep -E "^${1}[ \t]+zts[ \t]*$")"; then if test -n "$(cat "${getDockerImageName_reqs}" | grep -E "^${1}[ \t]+zts[ \t]*$")"; then
getExtensionImage_result="php:${getExtensionImage_version}-zts" getDockerImageName_suffix="-zts"
fi fi
fi fi
printf '%s' "${getExtensionImage_result}" case "${DOCKER_DISTRO:-}" in
alpine)
getDockerImageName_distro="-$DOCKER_DISTRO"
;;
*)
getDockerImageName_distro=''
;;
esac
printf 'php:%s%s%s' "${getDockerImageName_version}" "${getDockerImageName_suffix}" "${getDockerImageName_distro}"
} }
@ -58,10 +66,10 @@ testExtension () {
printf ' INVALID PHP VERSION: %s\n' "${2}" >&2 printf ' INVALID PHP VERSION: %s\n' "${2}" >&2
return 1 return 1
fi fi
testExtension_Image="$(getExtensionImage "${1}" "${2}")" testExtension_Image="$(getDockerImageName "${1}" "${2}")"
printf ' - Docker image: %s\n' "${testExtension_Image}" printf ' - Docker image: %s\n' "${testExtension_Image}"
testExtension_out=`mktemp` testExtension_out=`mktemp`
if $(docker run --rm --volume "${TRAVIS_BUILD_DIR}:/app" --workdir /app "${testExtension_Image}" bash -c "./install-php-extensions '${1}' && php ./scripts/check-installed-extension.php '${1}'" >"${testExtension_out}" 2>&1); then if $(docker run --rm --volume "${TRAVIS_BUILD_DIR}:/app" --workdir /app "${testExtension_Image}" sh -c "./install-php-extensions '${1}' && php ./scripts/check-installed-extension.php '${1}'" >"${testExtension_out}" 2>&1); then
rm -rf "${testExtension_out}" rm -rf "${testExtension_out}"
printf ' - Passed\n' printf ' - Passed\n'
return 0 return 0
@ -148,6 +156,9 @@ getAllPHPVersionsFor () {
# Arguments: # Arguments:
# $1: the commit hash # $1: the commit hash
# #
# Set:
# STOP_NEXT_COMMITS to 1 if we should skip next commits
#
# Return: # Return:
# 0 (true): if test passes # 0 (true): if test passes
# 1 (false): if test fails # 1 (false): if test fails
@ -178,7 +189,9 @@ testExtensionsFromMessage () {
if test -n "$TESTLIST"; then if test -n "$TESTLIST"; then
IFS=' ,;' IFS=' ,;'
for COMMIT_LINE_EXT in $TESTLIST; do for COMMIT_LINE_EXT in $TESTLIST; do
if test -z "$TEST_EXTENSIONS"; then if test $COMMIT_LINE_EXT = '-STOP-'; then
STOP_NEXT_COMMITS=1
elif test -z "$TEST_EXTENSIONS"; then
TEST_EXTENSIONS=$COMMIT_LINE_EXT; TEST_EXTENSIONS=$COMMIT_LINE_EXT;
else else
if ! stringInList "$COMMIT_LINE_EXT" "$TEST_EXTENSIONS"; then if ! stringInList "$COMMIT_LINE_EXT" "$TEST_EXTENSIONS"; then
@ -202,7 +215,7 @@ testExtensionsFromMessage () {
return $testExtensionsFromMessage_result return $testExtensionsFromMessage_result
} }
STOP_NEXT_COMMITS=0
TESTS_RESULTS=0 TESTS_RESULTS=0
ADDED_EXTENSION_LINE= ADDED_EXTENSION_LINE=
FOUND_ATAT= FOUND_ATAT=
@ -231,6 +244,9 @@ for COMMIT_HASH in $(git -C "${TRAVIS_BUILD_DIR}" log --pretty='format:%H' "${TR
if ! testExtensionsFromMessage "$COMMIT_HASH"; then if ! testExtensionsFromMessage "$COMMIT_HASH"; then
TESTS_RESULTS=1 TESTS_RESULTS=1
fi fi
if test $STOP_NEXT_COMMITS -eq 1; then
break
fi
done done
if test ${TESTS_RESULTS} -ne 0; then if test ${TESTS_RESULTS} -ne 0; then