From ef7d7a951426d1f6e868db1413190d3260fab5dd Mon Sep 17 00:00:00 2001 From: Burhan Ali Date: Wed, 13 Nov 2024 09:19:40 +0000 Subject: [PATCH 1/4] Add PHP 8.3 files --- 8.3/.dockerignore | 1 + 8.3/Dockerfile | 78 ++++++++++++++++++++++++++++ 8.3/debug.Dockerfile | 10 ++++ 8.3/php.bats | 64 +++++++++++++++++++++++ 8.3/php/conf.d/00_memlimit.ini | 3 ++ 8.3/php/conf.d/00_short_open_tag.ini | 13 +++++ 8.3/php_debug.bats | 9 ++++ 8.3/tags.bats | 13 +++++ 8 files changed, 191 insertions(+) create mode 100644 8.3/.dockerignore create mode 100644 8.3/Dockerfile create mode 100644 8.3/debug.Dockerfile create mode 100755 8.3/php.bats create mode 100644 8.3/php/conf.d/00_memlimit.ini create mode 100644 8.3/php/conf.d/00_short_open_tag.ini create mode 100755 8.3/php_debug.bats create mode 100644 8.3/tags.bats diff --git a/8.3/.dockerignore b/8.3/.dockerignore new file mode 100644 index 0000000..e46b33e --- /dev/null +++ b/8.3/.dockerignore @@ -0,0 +1 @@ +*.bats diff --git a/8.3/Dockerfile b/8.3/Dockerfile new file mode 100644 index 0000000..090e8d1 --- /dev/null +++ b/8.3/Dockerfile @@ -0,0 +1,78 @@ +FROM alpine:3.19 + +LABEL maintainer="developers@graze.com" \ + license="MIT" \ + org.label-schema.schema-version="1.0" \ + org.label-schema.vendor="graze" \ + org.label-schema.name="php-alpine" \ + org.label-schema.description="small php image based on alpine" \ + org.label-schema.vcs-url="https://github.com/graze/docker-php-alpine" + +# Fix for iconv: https://github.com/docker-library/php/issues/240 +RUN apk add gnu-libiconv=1.15-r3 --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.13/community/ --allow-untrusted + +RUN set -xe \ + && echo "@php http://dl-cdn.alpinelinux.org/alpine/v3.19/community" >> /etc/apk/repositories \ + && apk add --update --no-cache \ + ca-certificates \ + curl \ + gnu-libiconv \ + openssh-client \ + libmemcached-libs \ + libevent \ + musl \ + yaml \ + php83 \ + php83-pecl-apcu \ + php83-pecl-event \ + php83-pecl-memcached \ + php83-pecl-yaml \ + php83-bcmath \ + php83-common \ + php83-ctype \ + php83-curl \ + php83-dom \ + php83-fileinfo \ + php83-iconv \ + php83-intl \ + php83-openssl \ + php83-opcache \ + php83-mbstring \ + php83-mysqlnd \ + php83-mysqli \ + php83-pcntl \ + php83-pgsql \ + php83-pdo_mysql \ + php83-pdo_pgsql \ + php83-pdo_sqlite \ + php83-phar \ + php83-posix \ + php83-simplexml \ + php83-session \ + php83-soap \ + php83-sockets \ + php83-sodium \ + php83-tokenizer \ + php83-xml \ + php83-xmlreader \ + php83-xmlwriter \ + php83-zip \ + php83-zlib + +ENV PHP_INI_DIR /etc/php83 + +RUN ln -s /usr/bin/php83 /usr/bin/php +RUN ln -s /usr/bin/pecl83 /usr/bin/pecl + +COPY php/conf.d/*.ini $PHP_INI_DIR/conf.d/ + +WORKDIR /srv + +ARG BUILD_DATE +ARG VCS_REF + +LABEL org.label-schema.vcs-ref=$VCS_REF \ + org.label-schema.build-date=$BUILD_DATE + +# Fix for iconv: https://github.com/docker-library/php/issues/240 +ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php diff --git a/8.3/debug.Dockerfile b/8.3/debug.Dockerfile new file mode 100644 index 0000000..58d3d1f --- /dev/null +++ b/8.3/debug.Dockerfile @@ -0,0 +1,10 @@ +FROM graze/php-alpine:8.3 + +RUN apk add --update --no-cache \ + php83-phpdbg + +ARG BUILD_DATE +ARG VCS_REF + +LABEL org.label-schema.vcs-ref=$VCS_REF \ + org.label-schema.build-date=$BUILD_DATE diff --git a/8.3/php.bats b/8.3/php.bats new file mode 100755 index 0000000..90b541a --- /dev/null +++ b/8.3/php.bats @@ -0,0 +1,64 @@ +#!/usr/bin/env bats + +@test "php version is correct" { + run docker run --rm ${container} php -v + echo 'status:' $status + echo 'output:' $output + version="$(echo $output | sed 's/.*PHP \([0-9].[0-9]\).*/\1/')" + echo 'version:' $version + [ "$status" -eq 0 ] + [[ "$version" == "8.3" ]] +} + +@test "the image has the correct php modules installed" { + run docker run --rm ${container} php -m + echo 'status:' $status + echo 'output:' $output + [ "$status" -eq 0 ] + [[ "${output}" == *"apcu"* ]] + [[ "${output}" == *"bcmath"* ]] + [[ "${output}" == *"Core"* ]] + [[ "${output}" == *"ctype"* ]] + [[ "${output}" == *"curl"* ]] + [[ "${output}" == *"date"* ]] + [[ "${output}" == *"dom"* ]] + [[ "${output}" == *"event"* ]] + [[ "${output}" == *"fileinfo"* ]] + [[ "${output}" == *"filter"* ]] + [[ "${output}" == *"hash"* ]] + [[ "${output}" == *"iconv"* ]] + [[ "${output}" == *"intl"* ]] + [[ "${output}" == *"json"* ]] + [[ "${output}" == *"libxml"* ]] + [[ "${output}" == *"mbstring"* ]] + [[ "${output}" == *"memcached"* ]] + [[ "${output}" == *"mysqli"* ]] + [[ "${output}" == *"mysqlnd"* ]] + [[ "${output}" == *"openssl"* ]] + [[ "${output}" == *"pcre"* ]] + [[ "${output}" == *"pcntl"* ]] + [[ "${output}" == *"PDO"* ]] + [[ "${output}" == *"pdo_mysql"* ]] + [[ "${output}" == *"pdo_pgsql"* ]] + [[ "${output}" == *"pdo_sqlite"* ]] + [[ "${output}" == *"pgsql"* ]] + [[ "${output}" == *"Phar"* ]] + [[ "${output}" == *"posix"* ]] + [[ "${output}" == *"readline"* ]] + [[ "${output}" == *"Reflection"* ]] + [[ "${output}" == *"session"* ]] + [[ "${output}" == *"SimpleXML"* ]] + [[ "${output}" == *"soap"* ]] + [[ "${output}" == *"sodium"* ]] + [[ "${output}" == *"sockets"* ]] + [[ "${output}" == *"SPL"* ]] + [[ "${output}" == *"standard"* ]] + [[ "${output}" == *"tokenizer"* ]] + [[ "${output}" == *"xml"* ]] + [[ "${output}" == *"xmlreader"* ]] + [[ "${output}" == *"xmlwriter"* ]] + [[ "${output}" == *"yaml"* ]] + [[ "${output}" == *"Zend OPcache"* ]] + [[ "${output}" == *"zip"* ]] + [[ "${output}" == *"zlib"* ]] +} diff --git a/8.3/php/conf.d/00_memlimit.ini b/8.3/php/conf.d/00_memlimit.ini new file mode 100644 index 0000000..d0c56ed --- /dev/null +++ b/8.3/php/conf.d/00_memlimit.ini @@ -0,0 +1,3 @@ +; Maximum amount of memory a script may consume (128MB) +; http://php.net/memory-limit +memory_limit = 1024M diff --git a/8.3/php/conf.d/00_short_open_tag.ini b/8.3/php/conf.d/00_short_open_tag.ini new file mode 100644 index 0000000..6f4646c --- /dev/null +++ b/8.3/php/conf.d/00_short_open_tag.ini @@ -0,0 +1,13 @@ +; This directive determines whether or not PHP will recognize code between +; tags as PHP source which should be processed as such. It's been +; recommended for several years that you not use the short tag "short cut" and +; instead to use the full tag combination. With the wide spread use +; of XML and use of these tags by other languages, the server can become easily +; confused and end up parsing the wrong code in the wrong context. But because +; this short cut has been a feature for such a long time, it's currently still +; supported for backwards compatibility, but we recommend you don't use them. +; Default Value: On +; Development Value: Off +; Production Value: Off +; http://php.net/short-open-tag +short_open_tag = On diff --git a/8.3/php_debug.bats b/8.3/php_debug.bats new file mode 100755 index 0000000..b226611 --- /dev/null +++ b/8.3/php_debug.bats @@ -0,0 +1,9 @@ +#!/usr/bin/env bats + +@test "the image has phpdbg" { + run docker run ${container} which phpdbg83 + echo 'status:' $status + echo 'output:' $output + [ "$status" -eq 0 ] + [[ "${output}" == *"phpdbg83"* ]] +} diff --git a/8.3/tags.bats b/8.3/tags.bats new file mode 100644 index 0000000..d8c9c09 --- /dev/null +++ b/8.3/tags.bats @@ -0,0 +1,13 @@ +#!/usr/bin/env bats + +@test "the main tags are created" { + run bash -c "docker images graze/php-alpine --format '{{.ID}} ({{.Tag}})' | grep "$(docker images graze/php-alpine:8.3 --format '{{.ID}}')"" + echo 'output:' $output + [[ "$output" == *"(8.3)"* ]] +} + +@test "the test tags are created" { + run bash -c "docker images graze/php-alpine --format '{{.ID}} ({{.Tag}})' | grep "$(docker images graze/php-alpine:8.3-test --format '{{.ID}}')"" + echo 'output:' $output + [[ "$output" == *"(8.3-test)"* ]] +} From bad45a85f6eb4ab5dd468b9092dba44acc5683c2 Mon Sep 17 00:00:00 2001 From: Burhan Ali Date: Wed, 13 Nov 2024 20:59:08 +0000 Subject: [PATCH 2/4] Fix typo in tag command --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1fbf1a8..54824eb 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,7 @@ prod-build-quick: prod-build-quick-%: make prod-build-$* cache="" pull="" -tag: tag-5.6 tag-7.0 tag-7.1 tag-7.2 tag-7.3 tag-7.4 tag-8.0 tag-8.1 test-8.2 +tag: tag-5.6 tag-7.0 tag-7.1 tag-7.2 tag-7.3 tag-7.4 tag-8.0 tag-8.1 tag-8.2 test: test-5.6 test-7.0 test-7.1 test-7.2 test-7.3 test-7.4 test-8.0 test-8.1 test-8.2 push: push-5.6 push-7.0 push-7.1 push-7.2 push-7.3 push-7.4 push-8.0 push-8.1 push-8.2 clean: clean-5.6 clean-7.0 clean-7.1 clean-7.2 clean-7.3 clean-7.4 clean-8.0 clean-8.1 clean-8.2 From 4313fbd853e531027b67fc244a487b42bc229994 Mon Sep 17 00:00:00 2001 From: Burhan Ali Date: Wed, 13 Nov 2024 21:02:42 +0000 Subject: [PATCH 3/4] Add 8.3 to the Makefile --- Makefile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 54824eb..9d38950 100644 --- a/Makefile +++ b/Makefile @@ -18,8 +18,8 @@ build_args := --build-arg BUILD_DATE=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ") \ latest_5 := 5.6 latest_7 := 7.4 -latest_8 := 8.2 -latest := 8.2 +latest_8 := 8.3 +latest := 8.3 .PHONY: build build-quick .PHONY: tag @@ -30,25 +30,25 @@ latest := 8.2 .PHONY: prod-build prod-build-quick .DEFAULT: build -build: build-5.6 build-7.0 build-7.1 build-7.2 build-7.3 build-7.4 build-8.0 build-8.1 build-8.2 +build: build-5.6 build-7.0 build-7.1 build-7.2 build-7.3 build-7.4 build-8.0 build-8.1 build-8.2 build-8.3 build-quick: make build cache="" pull="" build-quick-%: make build-$* cache="" pull="" -prod-build: prod-build-5.6 prod-build-7.0 prod-build-7.1 prod-build-7.2 prod-build-7.3 prod-build-7.4 prod-build-8.0 prod-build-8.1 prod-build-8.2 +prod-build: prod-build-5.6 prod-build-7.0 prod-build-7.1 prod-build-7.2 prod-build-7.3 prod-build-7.4 prod-build-8.0 prod-build-8.1 prod-build-8.2 prod-build-8.3 prod-build-quick: make prod-build cache="" pull="" prod-build-quick-%: make prod-build-$* cache="" pull="" -tag: tag-5.6 tag-7.0 tag-7.1 tag-7.2 tag-7.3 tag-7.4 tag-8.0 tag-8.1 tag-8.2 -test: test-5.6 test-7.0 test-7.1 test-7.2 test-7.3 test-7.4 test-8.0 test-8.1 test-8.2 -push: push-5.6 push-7.0 push-7.1 push-7.2 push-7.3 push-7.4 push-8.0 push-8.1 push-8.2 -clean: clean-5.6 clean-7.0 clean-7.1 clean-7.2 clean-7.3 clean-7.4 clean-8.0 clean-8.1 clean-8.2 -deploy: deploy-5.6 deploy-7.0 deploy-7.1 deploy-7.2 deploy-7.3 deploy-7.4 deploy-8.0 deploy-8.1 deploy-8.2 +tag: tag-5.6 tag-7.0 tag-7.1 tag-7.2 tag-7.3 tag-7.4 tag-8.0 tag-8.1 tag-8.2 tag-8.3 +test: test-5.6 test-7.0 test-7.1 test-7.2 test-7.3 test-7.4 test-8.0 test-8.1 test-8.2 test-8.3 +push: push-5.6 push-7.0 push-7.1 push-7.2 push-7.3 push-7.4 push-8.0 push-8.1 push-8.2 push-8.3 +clean: clean-5.6 clean-7.0 clean-7.1 clean-7.2 clean-7.3 clean-7.4 clean-8.0 clean-8.1 clean-8.2 clean-8.3 +deploy: deploy-5.6 deploy-7.0 deploy-7.1 deploy-7.2 deploy-7.3 deploy-7.4 deploy-8.0 deploy-8.1 deploy-8.2 deploy-8.3 build-%: cache ?= --no-cache build-%: pull ?= --pull From 590e089a6fdf1a89c1e7f3b21b8a82ab60f7c5eb Mon Sep 17 00:00:00 2001 From: Burhan Ali Date: Wed, 13 Nov 2024 21:04:43 +0000 Subject: [PATCH 4/4] Fix some copypasta in tests --- 8.1/tags.bats | 4 ++-- 8.2/tags.bats | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/8.1/tags.bats b/8.1/tags.bats index 19eb11e..c970acf 100644 --- a/8.1/tags.bats +++ b/8.1/tags.bats @@ -1,13 +1,13 @@ #!/usr/bin/env bats @test "the main tags are created" { - run bash -c "docker images graze/php-alpine --format '{{.ID}} ({{.Tag}})' | grep "$(docker images graze/php-alpine:8.0 --format '{{.ID}}')"" + run bash -c "docker images graze/php-alpine --format '{{.ID}} ({{.Tag}})' | grep "$(docker images graze/php-alpine:8.1 --format '{{.ID}}')"" echo 'output:' $output [[ "$output" == *"(8.1)"* ]] } @test "the test tags are created" { - run bash -c "docker images graze/php-alpine --format '{{.ID}} ({{.Tag}})' | grep "$(docker images graze/php-alpine:8.0-test --format '{{.ID}}')"" + run bash -c "docker images graze/php-alpine --format '{{.ID}} ({{.Tag}})' | grep "$(docker images graze/php-alpine:8.1-test --format '{{.ID}}')"" echo 'output:' $output [[ "$output" == *"(8.1-test)"* ]] } diff --git a/8.2/tags.bats b/8.2/tags.bats index 11f2c80..fd22ea8 100644 --- a/8.2/tags.bats +++ b/8.2/tags.bats @@ -1,13 +1,13 @@ #!/usr/bin/env bats @test "the main tags are created" { - run bash -c "docker images graze/php-alpine --format '{{.ID}} ({{.Tag}})' | grep "$(docker images graze/php-alpine:8.0 --format '{{.ID}}')"" + run bash -c "docker images graze/php-alpine --format '{{.ID}} ({{.Tag}})' | grep "$(docker images graze/php-alpine:8.2 --format '{{.ID}}')"" echo 'output:' $output [[ "$output" == *"(8.2)"* ]] } @test "the test tags are created" { - run bash -c "docker images graze/php-alpine --format '{{.ID}} ({{.Tag}})' | grep "$(docker images graze/php-alpine:8.0-test --format '{{.ID}}')"" + run bash -c "docker images graze/php-alpine --format '{{.ID}} ({{.Tag}})' | grep "$(docker images graze/php-alpine:8.2-test --format '{{.ID}}')"" echo 'output:' $output [[ "$output" == *"(8.2-test)"* ]] }