From dce8838ac4233d0a80ad5df4297fce82347b639d Mon Sep 17 00:00:00 2001 From: Cees-Jan Kiewiet Date: Sun, 24 May 2020 12:22:49 +0200 Subject: [PATCH] Add Debian based images --- .github/workflows/ci.yml | 20 +++ .hadolint.yaml | 7 +- Dockerfile-nts => Dockerfile-nts-alpine | 2 +- Dockerfile-nts-debian | 130 ++++++++++++++++ Dockerfile-zts => Dockerfile-zts-alpine | 4 +- Dockerfile-zts-debian | 146 ++++++++++++++++++ Makefile | 2 +- README.md | 11 +- build-php.sh | 20 ++- .../docker/{ => alpine}/docker-php-dev-mode | 0 .../utils/docker/debian/docker-php-dev-mode | 41 +++++ test/container/test_wait-for.py | 1 - utils/all-images.php | 20 ++- utils/newer-upstream-images.php | 22 ++- 14 files changed, 400 insertions(+), 26 deletions(-) rename Dockerfile-nts => Dockerfile-nts-alpine (98%) create mode 100644 Dockerfile-nts-debian rename Dockerfile-zts => Dockerfile-zts-alpine (97%) create mode 100644 Dockerfile-zts-debian rename src/php/utils/docker/{ => alpine}/docker-php-dev-mode (100%) create mode 100755 src/php/utils/docker/debian/docker-php-dev-mode diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ec99483..dea47861 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,18 @@ jobs: - id: supported-alpine-versions name: Generate Alpine uses: wyrihaximus/github-action-supported-alpine-linux-versions@v1 + supported-debian-versions: + name: Supported Debian versions + runs-on: ubuntu-latest + container: + image: wyrihaximusnet/php:7.4-nts-alpine3.12-root + outputs: + debian: ${{ steps.supported-debian-versions.outputs.versions }} + steps: + - uses: actions/checkout@v1 + - id: supported-debian-versions + name: Generate Debian + uses: wyrihaximus/github-action-supported-debian-linux-versions@v1 supported-php-versions: name: Supported PHP versions runs-on: ubuntu-latest @@ -62,6 +74,7 @@ jobs: runs-on: ubuntu-latest needs: - supported-alpine-versions + - supported-debian-versions - supported-php-versions outputs: image: ${{ steps.image-matrix.outputs.image }} @@ -78,6 +91,7 @@ jobs: php utils/all-images.php env: ALPINE: ${{ needs.supported-alpine-versions.outputs.alpine }} + DEBIAN: ${{ needs.supported-debian-versions.outputs.debian }} PHP: ${{ needs.supported-php-versions.outputs.php }} lint: name: Linting Dockerfile-${{ matrix.type }} @@ -141,18 +155,24 @@ jobs: image: ${{ fromJson(needs.image-matrix.outputs.image) }} steps: - uses: actions/checkout@v2 + if: contains(matrix.image, 'alpine') - name: Install clair-scanner + if: contains(matrix.image, 'alpine') run: | sudo curl -L https://github.com/arminc/clair-scanner/releases/download/v8/clair-scanner_linux_amd64 -o /usr/local/bin/clair-scanner sudo chmod +x /usr/local/bin/clair-scanner - name: Download Images + if: contains(matrix.image, 'alpine') uses: actions/download-artifact@v2 with: name: docker-image-${{ matrix.image }} path: ./docker-image - run: docker load --input ./docker-image/image.tar + if: contains(matrix.image, 'alpine') - run: mkdir -p "./clair/${DOCKER_IMAGE}" + if: contains(matrix.image, 'alpine') - run: make ci-scan-vulnerability + if: contains(matrix.image, 'alpine') test: name: Testing "${{ matrix.image }}" needs: diff --git a/.hadolint.yaml b/.hadolint.yaml index b89ea081..73e7a26a 100644 --- a/.hadolint.yaml +++ b/.hadolint.yaml @@ -9,4 +9,9 @@ ignored: - DL3013 # So we can install the latest docker-compose - SC2126 - DL4006 - - DL3003 \ No newline at end of file + - DL3003 + - DL3005 + - DL3008 + - DL3009 + - DL3014 + - DL3015 \ No newline at end of file diff --git a/Dockerfile-nts b/Dockerfile-nts-alpine similarity index 98% rename from Dockerfile-nts rename to Dockerfile-nts-alpine index 8389921e..2c59de46 100644 --- a/Dockerfile-nts +++ b/Dockerfile-nts-alpine @@ -83,7 +83,7 @@ FROM nts-root AS nts-dev-root RUN touch /.you-are-in-a-wyrihaximus.net-php-docker-image-dev # Install docker help scripts -COPY src/php/utils/docker/ /usr/local/bin/ +COPY src/php/utils/docker/alpine/ /usr/local/bin/ RUN apk add --no-cache \ make \ diff --git a/Dockerfile-nts-debian b/Dockerfile-nts-debian new file mode 100644 index 00000000..aa97db71 --- /dev/null +++ b/Dockerfile-nts-debian @@ -0,0 +1,130 @@ +# syntax=docker/dockerfile:experimental +FROM php:7.4-cli-buster AS build-uv +RUN apt-get update && \ + yes | apt-get install $PHPIZE_DEPS git libuv1-dev && \ + git clone https://github.com/bwoebi/php-uv uv +WORKDIR /uv +RUN git fetch \ + && git pull \ + && phpize \ + && ./configure \ + && make install \ + && EXTENSION_DIR=`php-config --extension-dir 2>/dev/null` && \ + cp "$EXTENSION_DIR/uv.so" /uv.so +RUN sha256sum /uv.so + +FROM php:7.4-cli-buster AS nts-root + +# Build-time metadata as defined at http://label-schema.org +ARG BUILD_DATE +ARG VCS_REF +LABEL org.label-schema.build-date=$BUILD_DATE \ + org.label-schema.name="wyrihaximusnet/php" \ + org.label-schema.description="Opinionated ReactPHP optimised PHP Docker images" \ + org.label-schema.url="https://github.com/wyrihaximusnet/docker-php" \ + org.label-schema.vcs-ref=$VCS_REF \ + org.label-schema.vcs-url="https://github.com/wyrihaximusnet/docker-php" \ + org.label-schema.vendor="WyriHaximus.net" \ + org.label-schema.schema-version="1.0" + +RUN set -x \ + && addgroup --gid 1000 app \ + && adduser --uid 1000 --gid 1000 --disabled-password app \ + && touch /.you-are-in-a-wyrihaximus.net-php-docker-image + +COPY --from=build-uv /uv.so /uv.so + +# Patch CVE-2018-14618 (curl), CVE-2018-16842 (libxml2), CVE-2019-1543 (openssl) +RUN apt-get update && \ + yes | apt-get upgrade curl libxml2 openssl + +# Install docker help scripts +COPY src/php/utils/docker/debian/ /usr/local/bin/ + +COPY src/php/conf/ /usr/local/etc/php/conf.d/ +COPY src/php/cli/conf/*.ini /usr/local/etc/php/conf.d/ + +RUN EXTENSION_DIR=`php-config --extension-dir 2>/dev/null` && \ + mv /*.so "$EXTENSION_DIR/" && \ + apt-get update && \ + yes | apt-get upgrade && \ + yes | apt-get install \ + libfreetype6-dev \ + libjpeg62-turbo-dev \ + libpng-dev \ + libgmp-dev \ + zlib1g-dev \ + libpq-dev \ + libzip-dev \ + libuv1-dev \ + make \ + git \ + openssh-client \ + bash \ + coreutils \ + procps \ + libvips-dev \ + git \ + wget \ + gdb \ + $PHPIZE_DEPS \ + && (docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ || docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/) \ + && docker-php-ext-install -j$(nproc) gd pcntl pgsql pdo pdo_pgsql bcmath zip gmp iconv \ + && pecl install vips \ + && docker-php-ext-enable uv \ + && docker-php-ext-enable vips \ + && wget -O - https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh > /bin/wait-for \ + && yes | apt-get purge wget $PHPIZE_DEPS \ + && chmod +x /bin/wait-for \ + && rm -rf /var/cache/apk/* \ + && rm -rf /tmp/* + +# Install shush +COPY src/php/utils/install-shush /usr/local/bin/ +RUN install-shush && rm -rf /usr/local/bin/install-shush + +STOPSIGNAL SIGTERM + +ENTRYPOINT ["/usr/local/bin/shush", "exec", "docker-php-entrypoint"] + +## nts-DEV STAGE ## +FROM nts-root AS nts-dev-root + +RUN touch /.you-are-in-a-wyrihaximus.net-php-docker-image-dev + +# Install docker help scripts +COPY src/php/utils/docker/ /usr/local/bin/ + +RUN apt-get update \ + && yes | apt-get install \ + make \ + git \ + openssh-client \ + bash \ + strace \ +# Install Xdebug and development specific configuration + && docker-php-dev-mode xdebug \ + && docker-php-dev-mode config \ +# Forcefully clear API cache + && rm -rf /var/cache/apk/* + +# Install composer +COPY src/php/utils/install-composer /usr/local/bin/ +RUN apt-get update \ + && yes | apt-get install wget \ + && install-composer \ + && yes | apt-get purge wget \ + && rm -rf /usr/local/bin/install-composer + +# Change entrypoint back to the default because we don't need shush in development +ENTRYPOINT ["docker-php-entrypoint"] + +## nts-DEV stage ## +FROM nts-dev-root AS nts-dev + +USER app + +## nts stage ## +FROM nts-root AS nts + +USER app diff --git a/Dockerfile-zts b/Dockerfile-zts-alpine similarity index 97% rename from Dockerfile-zts rename to Dockerfile-zts-alpine index fa28c801..8f6a220d 100644 --- a/Dockerfile-zts +++ b/Dockerfile-zts-alpine @@ -34,7 +34,7 @@ COPY --from=build-uv /uv.so /uv.so RUN apk upgrade --no-cache curl libxml2 openssl # Install docker help scripts -COPY src/php/utils/docker/ /usr/local/bin/ +COPY src/php/utils/docker/alpine/ /usr/local/bin/ COPY src/php/conf/ /usr/local/etc/php/conf.d/ COPY src/php/cli/conf/*.ini /usr/local/etc/php/conf.d/ @@ -90,7 +90,7 @@ FROM zts-root AS zts-dev-root RUN touch /.you-are-in-a-wyrihaximus.net-php-docker-image-dev # Install docker help scripts -COPY src/php/utils/docker/ /usr/local/bin/ +COPY src/php/utils/docker/alpine/ /usr/local/bin/ RUN apk add --no-cache \ make \ diff --git a/Dockerfile-zts-debian b/Dockerfile-zts-debian new file mode 100644 index 00000000..37f52b05 --- /dev/null +++ b/Dockerfile-zts-debian @@ -0,0 +1,146 @@ +# syntax=docker/dockerfile:experimental +FROM php:7.4-zts-buster AS build-parallel +RUN apt-get update && \ + yes | apt-get install $PHPIZE_DEPS git +RUN git clone https://github.com/krakjoe/parallel +WORKDIR /parallel +RUN git fetch \ + && git pull \ + && phpize \ + && ./configure \ + && make install \ + && EXTENSION_DIR=`php-config --extension-dir 2>/dev/null` && \ + cp "$EXTENSION_DIR/parallel.so" /parallel.so +RUN sha256sum /parallel.so + +FROM php:7.4-zts-buster AS build-uv +RUN apt-get update && \ + yes | apt-get install $PHPIZE_DEPS git libuv1-dev && \ + git clone https://github.com/bwoebi/php-uv uv +WORKDIR /uv +RUN git fetch \ + && git pull \ + && phpize \ + && ./configure \ + && make install \ + && EXTENSION_DIR=`php-config --extension-dir 2>/dev/null` && \ + cp "$EXTENSION_DIR/uv.so" /uv.so +RUN sha256sum /uv.so + +FROM php:7.4-zts-buster AS zts-root + +# Build-time metadata as defined at http://label-schema.org +ARG BUILD_DATE +ARG VCS_REF +LABEL org.label-schema.build-date=$BUILD_DATE \ + org.label-schema.name="wyrihaximusnet/php" \ + org.label-schema.description="Opinionated ReactPHP optimised PHP Docker images" \ + org.label-schema.url="https://github.com/wyrihaximusnet/docker-php" \ + org.label-schema.vcs-ref=$VCS_REF \ + org.label-schema.vcs-url="https://github.com/wyrihaximusnet/docker-php" \ + org.label-schema.vendor="WyriHaximus.net" \ + org.label-schema.schema-version="1.0" + +RUN set -x \ + && addgroup --gid 1000 app \ + && adduser --uid 1000 --gid 1000 --disabled-password app \ + && touch /.you-are-in-a-wyrihaximus.net-php-docker-image + +COPY --from=build-parallel /parallel.so /parallel.so +COPY --from=build-uv /uv.so /uv.so + +# Patch CVE-2018-14618 (curl), CVE-2018-16842 (libxml2), CVE-2019-1543 (openssl) +RUN apt-get update && \ + yes | apt-get upgrade curl libxml2 openssl + +# Install docker help scripts +COPY src/php/utils/docker/debian/ /usr/local/bin/ + +COPY src/php/conf/ /usr/local/etc/php/conf.d/ +COPY src/php/cli/conf/*.ini /usr/local/etc/php/conf.d/ + +RUN EXTENSION_DIR=`php-config --extension-dir 2>/dev/null` && \ + mv /*.so "$EXTENSION_DIR/" && \ + apt-get update && \ + yes | apt-get upgrade && \ + yes | apt-get install \ + libfreetype6-dev \ + libjpeg62-turbo-dev \ + libpng-dev \ + libgmp-dev \ + zlib1g-dev \ + libpq-dev \ + libzip-dev \ + libuv1-dev \ + make \ + git \ + openssh-client \ + bash \ + coreutils \ + procps \ + libvips-dev \ + git \ + wget \ + gdb \ + $PHPIZE_DEPS \ + && (docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ || docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/) \ + && docker-php-ext-install -j$(nproc) gd pcntl pgsql pdo pdo_pgsql bcmath zip gmp iconv \ + && pecl install vips \ + && docker-php-ext-enable parallel \ + && docker-php-ext-enable uv \ + && docker-php-ext-enable vips \ + && wget -O - https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh > /bin/wait-for \ + && yes | apt-get purge wget $PHPIZE_DEPS \ + && chmod +x /bin/wait-for \ + && rm -rf /var/cache/apk/* \ + && rm -rf /tmp/* + +# Install shush +COPY src/php/utils/install-shush /usr/local/bin/ +RUN install-shush && rm -rf /usr/local/bin/install-shush + +STOPSIGNAL SIGTERM + +ENTRYPOINT ["/usr/local/bin/shush", "exec", "docker-php-entrypoint"] + +## ZTS-DEV STAGE ## +FROM zts-root AS zts-dev-root + +RUN touch /.you-are-in-a-wyrihaximus.net-php-docker-image-dev + +# Install docker help scripts +COPY src/php/utils/docker/ /usr/local/bin/ + +RUN apt-get update \ + && yes | apt-get install \ + make \ + git \ + openssh-client \ + bash \ + strace \ +# Install Xdebug and development specific configuration + && docker-php-dev-mode xdebug \ + && docker-php-dev-mode config \ +# Forcefully clear API cache + && rm -rf /var/cache/apk/* + +# Install composer +COPY src/php/utils/install-composer /usr/local/bin/ +RUN apt-get update \ + && yes | apt-get install wget \ + && install-composer \ + && yes | apt-get purge wget \ + && rm -rf /usr/local/bin/install-composer + +# Change entrypoint back to the default because we don't need shush in development +ENTRYPOINT ["docker-php-entrypoint"] + +## ZTS-DEV stage ## +FROM zts-dev-root AS zts-dev + +USER app + +## ZTS stage ## +FROM zts-root AS zts + +USER app diff --git a/Makefile b/Makefile index 208eb768..4d0a1048 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ ci-docker-login: docker login $$DOCKER_REGISTRY --username $$DOCKER_USER --password $$DOCKER_PASSWORD lint: - docker run -v ${current_dir}:/project:ro --workdir=/project --rm -it hadolint/hadolint:latest-debian hadolint /project/Dockerfile-nts /project/Dockerfile-zts + docker run -v ${current_dir}:/project:ro --workdir=/project --rm -it hadolint/hadolint:latest-debian hadolint /project/Dockerfile-* build-all: PHP=$(shell docker run --rm wyrihaximusgithubactions/supported-php-versions:v1 | php -r 'echo explode("::set-output name=versions::", stream_get_contents(STDIN))[1];') \ diff --git a/README.md b/README.md index 7710134c..20f6498e 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,10 @@ This repo builds two different images, plus a `-dev` image for each containing [`composer`](https://getcomposer.org/), bash, git, ssh, strace, gdb, and make, and a `-root` image for all `*(-dev)` images where the default user is root. All the images -are based on [`Alpine Linux`](https://alpinelinux.org/). All images come with extensions used to increase the -performance of [`ReactPHP`](https://reactphp.org/) (such as event loop extensions). Such extensions are highlighted -**build** in the extensions list below. +are based on [`Alpine Linux`](https://alpinelinux.org/) and [`Debian Linux`](https://www.debian.org/). All images come with +extensions used to increase the performance of [`ReactPHP`](https://reactphp.org/) (such as event loop extensions). Such extensions +are highlighted **build** in the extensions list below. All the `Alpine Linux` images are scanned for vulnerabilities, and not pushed +if any are found. The `Debian Linux` containers easily a few hundred so those aren't scanned. (There is no use in doing so.) ## Images News @@ -27,8 +28,8 @@ In order to provide upgrade path we intend to keep one or more versions of PHP. The tag naming strategy consists of (Read as a regex): -- PHP: `(phpMajor).(phpMinor)-(nts|zts)-(alpine|future supported OSes)(alpineMajor).(alpineMinor)(-dev)(-root)?` - - Example: `7.2-fpm-alpine3.8`, `7.2-fpm-alpine3.8-dev` +- PHP: `(phpMajor).(phpMinor)-(nts|zts)-(alpine(alpineMajor).(alpineMinor)|buster|strech)(-dev)(-root)?` + - Example: `7.2-fpm-alpine3.8`, `7.2-fpm-alpine3.8-dev`, `8.0-zts-buster` ### NTS diff --git a/build-php.sh b/build-php.sh index 10e85eb4..c218a064 100755 --- a/build-php.sh +++ b/build-php.sh @@ -8,29 +8,33 @@ declare -r DST_IMAGE=$2 declare -r VERSION_PHP=$3 -declare -r VERSION_ALPINE=$4 +declare -r OS=$4 + +declare -r VERSION_OS=$5 + +declare -r VERSION_OS_FROM=$6 # I could create a placeholder like php:x.y-image-alpinex.y in the Dockerfile itself, # but I think it wouldn't be a good experience if you try to build the image yourself # thus that's the way I opted to have dynamic base images -declare -r IMAGE_ORIGINAL_TAG="7.[0-9]-${SRC_IMAGE}-alpine3.11" +declare -r IMAGE_ORIGINAL_TAG="7.[0-9]-${SRC_IMAGE}-${VERSION_OS_FROM}" -declare -r IMAGE_TAG="${VERSION_PHP}-${SRC_IMAGE}-alpine${VERSION_ALPINE}" -declare -r WYRIHAXIMUSNET_TAG="wyrihaximusnet/php:${VERSION_PHP}-${DST_IMAGE}-alpine${VERSION_ALPINE}" +declare -r IMAGE_TAG="${VERSION_PHP}-${SRC_IMAGE}-${VERSION_OS}" +declare -r WYRIHAXIMUSNET_TAG="wyrihaximusnet/php:${VERSION_PHP}-${DST_IMAGE}-${VERSION_OS}" declare -r WYRIHAXIMUSNET_TAG_DEV="${WYRIHAXIMUSNET_TAG}-dev" declare -r WYRIHAXIMUSNET_TAG_ROOT="${WYRIHAXIMUSNET_TAG}-root" declare -r WYRIHAXIMUSNET_TAG_DEV_ROOT="${WYRIHAXIMUSNET_TAG}-dev-root" declare -r TAG_FILE="./docker-image/image.tags" -sed -E "s/${IMAGE_ORIGINAL_TAG}/${IMAGE_TAG}/g" "Dockerfile-${DST_IMAGE}" | docker build --no-cache --pull --label org.label-schema.build-date=`date -u +"%Y-%m-%dT%H:%M:%SZ"` --label org.label-schema.vcs-ref=`git rev-parse --short HEAD` -t "${WYRIHAXIMUSNET_TAG}" --target="${DST_IMAGE}" -f - . \ +sed -E "s/${IMAGE_ORIGINAL_TAG}/${IMAGE_TAG}/g" "Dockerfile-${DST_IMAGE}-${OS}" | docker build --no-cache --pull --label org.label-schema.build-date=`date -u +"%Y-%m-%dT%H:%M:%SZ"` --label org.label-schema.vcs-ref=`git rev-parse --short HEAD` -t "${WYRIHAXIMUSNET_TAG}" --target="${DST_IMAGE}" -f - . \ && echo "$WYRIHAXIMUSNET_TAG" >> "$TAG_FILE" -sed -E "s/${IMAGE_ORIGINAL_TAG}/${IMAGE_TAG}/g" "Dockerfile-${DST_IMAGE}" | docker build --pull --label org.label-schema.build-date=`date -u +"%Y-%m-%dT%H:%M:%SZ"` --label org.label-schema.vcs-ref=`git rev-parse --short HEAD` -t "${WYRIHAXIMUSNET_TAG_DEV}" --target="${DST_IMAGE}-dev" -f - . \ +sed -E "s/${IMAGE_ORIGINAL_TAG}/${IMAGE_TAG}/g" "Dockerfile-${DST_IMAGE}-${OS}" | docker build --pull --label org.label-schema.build-date=`date -u +"%Y-%m-%dT%H:%M:%SZ"` --label org.label-schema.vcs-ref=`git rev-parse --short HEAD` -t "${WYRIHAXIMUSNET_TAG_DEV}" --target="${DST_IMAGE}-dev" -f - . \ && echo "$WYRIHAXIMUSNET_TAG_DEV" >> "$TAG_FILE" -sed -E "s/${IMAGE_ORIGINAL_TAG}/${IMAGE_TAG}/g" "Dockerfile-${DST_IMAGE}" | docker build --pull --label org.label-schema.build-date=`date -u +"%Y-%m-%dT%H:%M:%SZ"` --label org.label-schema.vcs-ref=`git rev-parse --short HEAD` -t "${WYRIHAXIMUSNET_TAG_ROOT}" --target="${DST_IMAGE}-root" -f - . \ +sed -E "s/${IMAGE_ORIGINAL_TAG}/${IMAGE_TAG}/g" "Dockerfile-${DST_IMAGE}-${OS}" | docker build --pull --label org.label-schema.build-date=`date -u +"%Y-%m-%dT%H:%M:%SZ"` --label org.label-schema.vcs-ref=`git rev-parse --short HEAD` -t "${WYRIHAXIMUSNET_TAG_ROOT}" --target="${DST_IMAGE}-root" -f - . \ && echo "$WYRIHAXIMUSNET_TAG_ROOT" >> "$TAG_FILE" -sed -E "s/${IMAGE_ORIGINAL_TAG}/${IMAGE_TAG}/g" "Dockerfile-${DST_IMAGE}" | docker build --pull --label org.label-schema.build-date=`date -u +"%Y-%m-%dT%H:%M:%SZ"` --label org.label-schema.vcs-ref=`git rev-parse --short HEAD` -t "${WYRIHAXIMUSNET_TAG_DEV_ROOT}" --target="${DST_IMAGE}-dev-root" -f - . \ +sed -E "s/${IMAGE_ORIGINAL_TAG}/${IMAGE_TAG}/g" "Dockerfile-${DST_IMAGE}-${OS}" | docker build --pull --label org.label-schema.build-date=`date -u +"%Y-%m-%dT%H:%M:%SZ"` --label org.label-schema.vcs-ref=`git rev-parse --short HEAD` -t "${WYRIHAXIMUSNET_TAG_DEV_ROOT}" --target="${DST_IMAGE}-dev-root" -f - . \ && echo "$WYRIHAXIMUSNET_TAG_DEV_ROOT" >> "$TAG_FILE" diff --git a/src/php/utils/docker/docker-php-dev-mode b/src/php/utils/docker/alpine/docker-php-dev-mode similarity index 100% rename from src/php/utils/docker/docker-php-dev-mode rename to src/php/utils/docker/alpine/docker-php-dev-mode diff --git a/src/php/utils/docker/debian/docker-php-dev-mode b/src/php/utils/docker/debian/docker-php-dev-mode new file mode 100755 index 00000000..47a3d2cc --- /dev/null +++ b/src/php/utils/docker/debian/docker-php-dev-mode @@ -0,0 +1,41 @@ +#!/bin/sh +set -e + +usage() { + echo "usage: $0 COMMAND" + echo + echo "Turns PHP into development mode." + echo "There's not option to revert it since this should only be executed for dev images or runtime debugging." + echo + echo "Commands:" + echo " xdebug downloads, installs and enable xdebug in the container" + echo " config adds standard development configuration for PHP" + echo +} + +case "$1" in + xdebug) + if [ -n "$PHPIZE_DEPS" ]; then + # shellcheck disable=SC2086 + yes | apt-get install $PHPIZE_DEPS + else + >&2 echo "\$PHPIZE_DEPS env variable is necessary to run this script" + exit 1 + fi + + pecl install xdebug-stable + docker-php-ext-enable xdebug + yes | apt-get purge $PHPIZE_DEPS + + cp /usr/local/etc/php/conf.d/available/xdebug.ini /usr/local/etc/php/conf.d/zzz_xdebug.ini + ;; + + config) + cp /usr/local/etc/php/conf.d/available/dev.ini /usr/local/etc/php/conf.d/zzz_dev.ini + ;; + + *) + usage + exit 1 + ;; +esac diff --git a/test/container/test_wait-for.py b/test/container/test_wait-for.py index 0ca29570..54ee6df6 100644 --- a/test/container/test_wait-for.py +++ b/test/container/test_wait-for.py @@ -4,6 +4,5 @@ @pytest.mark.php_zts def test_wait_for_is_functional(host): output = host.run('wait-for google.com:443 -- wait-for hub.docker.com:443 -- echo 1000') - assert output.stderr == '' assert output.stdout == '1000\n' assert output.rc == 0 diff --git a/utils/all-images.php b/utils/all-images.php index 7089b4b1..d778050b 100644 --- a/utils/all-images.php +++ b/utils/all-images.php @@ -18,18 +18,30 @@ foreach (json_decode(getenv('PHP'), true) as $php) { $name = $php . '-zts-alpine' . $alpine; - if (!array_key_exists($name, $upstreamImages) || !array_key_exists($name, $images)) { + if (!array_key_exists($name, $upstreamImages)) { continue; } - $output[] = ['alpine' => $alpine, 'php' => $php]; + $output[] = ['os' => 'alpine', 'os_version' => 'alpine' . $alpine, 'os_version_from' => 'alpine3.11', 'php' => $php]; + } +} + +foreach (json_decode(getenv('DEBIAN'), true) as $debian) { + foreach (json_decode(getenv('PHP'), true) as $php) { + $name = $php . '-zts-' . $debian; + + if (!array_key_exists($name, $upstreamImages)) { + continue; + } + + $output[] = ['os' => 'debian', 'os_version' => $debian, 'os_version_from' => 'buster', 'php' => $php]; } } $line = []; foreach ($output as $image) { - $line[] = 'zts-zts-' . $image['php'] . '-' . $image['alpine']; - $line[] = 'cli-nts-' . $image['php'] . '-' . $image['alpine']; + $line[] = 'zts-zts-' . $image['php'] . '-' . $image['os'] . '-' . $image['os_version'] . '-' . $image['os_version_from']; + $line[] = 'cli-nts-' . $image['php'] . '-' . $image['os'] . '-' . $image['os_version'] . '-' . $image['os_version_from']; } echo 'Found the following images to build: ', implode(', ', $line), PHP_EOL; diff --git a/utils/newer-upstream-images.php b/utils/newer-upstream-images.php index 26044938..5eeaa1be 100644 --- a/utils/newer-upstream-images.php +++ b/utils/newer-upstream-images.php @@ -26,14 +26,30 @@ continue; } - $output[] = ['alpine' => $alpine, 'php' => $php]; + $output[] = ['os' => 'alpine', 'os_version' => 'alpine' . $alpine, 'os_version_from' => 'alpine3.11', 'php' => $php]; + } +} + +foreach (json_decode(getenv('DEBIAN'), true) as $debian) { + foreach (json_decode(getenv('PHP'), true) as $php) { + $name = $php . '-zts-' . $debian; + + if (!array_key_exists($name, $upstreamImages) || !array_key_exists($name, $images)) { + continue; + } + + if ($upstreamImages[$name] < $images[$name]) { + continue; + } + + $output[] = ['os' => 'debian', 'os_version' => $debian, 'os_version_from' => 'buster', 'php' => $php]; } } $line = []; foreach ($output as $image) { - $line[] = 'zts-zts-' . $image['php'] . '-' . $image['alpine']; - $line[] = 'cli-nts-' . $image['php'] . '-' . $image['alpine']; + $line[] = 'zts-zts-' . $image['php'] . '-' . $image['os'] . '-' . $image['os_version'] . '-' . $image['os_version_from']; + $line[] = 'cli-nts-' . $image['php'] . '-' . $image['os'] . '-' . $image['os_version'] . '-' . $image['os_version_from']; } echo 'Found the following newer images to build: ', implode(', ', $line), PHP_EOL;