Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 97 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Build

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
matrix:
name: Load matrix
runs-on: ubuntu-latest
outputs:
include: ${{ steps.load.outputs.include }}
steps:
- uses: actions/checkout@v6
- id: load
run: echo "include=$(jq -c . versions.json)" >> "$GITHUB_OUTPUT"

build:
name: PHP ${{ matrix.version }}
needs: matrix
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.matrix.outputs.include) }}
steps:
- uses: actions/checkout@v6

# Test phase uses the default docker driver so the debug image's
# `FROM graze/php-alpine:VER` can resolve the just-built base from
# the local daemon. The docker driver is single-platform only.
- name: Build (single-arch for tests)
run: make build-${{ matrix.version }} platform=--platform=linux/amd64

- name: Tag
run: make tag-${{ matrix.version }}

- name: Test
run: make test-${{ matrix.version }}

- name: Set up QEMU
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
uses: docker/setup-qemu-action@v4

- name: Set up Docker Buildx
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
uses: docker/setup-buildx-action@v4

- name: Login to Docker Hub
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push (multi-arch)
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
run: |
V="${{ matrix.version }}"
BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
VCS_REF="$(git rev-parse --short HEAD)"

main_tags="-t graze/php-alpine:${V}"
test_tags="-t graze/php-alpine:${V}-test"
case "$V" in
5.6)
main_tags="$main_tags -t graze/php-alpine:5"
test_tags="$test_tags -t graze/php-alpine:5-test"
;;
7.4)
main_tags="$main_tags -t graze/php-alpine:7"
test_tags="$test_tags -t graze/php-alpine:7-test"
;;
8.5)
main_tags="$main_tags -t graze/php-alpine:8 -t graze/php-alpine:latest"
test_tags="$test_tags -t graze/php-alpine:8-test -t graze/php-alpine:test"
;;
esac

docker buildx build \
--push \
--platform=${{ matrix.platforms }} \
--build-arg BUILD_DATE="$BUILD_DATE" \
--build-arg VCS_REF="$VCS_REF" \
$main_tags \
"./$V"

docker buildx build \
--push \
--platform=${{ matrix.platforms }} \
--build-arg BUILD_DATE="$BUILD_DATE" \
--build-arg VCS_REF="$VCS_REF" \
-f "./$V/debug.Dockerfile" \
$test_tags \
"./$V"
35 changes: 0 additions & 35 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions 8.1/tags.bats
Original file line number Diff line number Diff line change
@@ -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)"* ]]
}
4 changes: 2 additions & 2 deletions 8.2/tags.bats
Original file line number Diff line number Diff line change
@@ -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)"* ]]
}
1 change: 1 addition & 0 deletions 8.3/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.bats
61 changes: 61 additions & 0 deletions 8.3/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
FROM php:8.3-cli-alpine3.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"

RUN set -xe \
&& apk add --no-cache \
openssh-client \
icu-libs \
libevent \
libmemcached-libs \
libpq \
libzip \
yaml \
&& apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
icu-dev \
libevent-dev \
libmemcached-dev \
libxml2-dev \
libzip-dev \
linux-headers \
postgresql-dev \
yaml-dev \
zlib-dev \
&& docker-php-ext-install -j$(nproc) \
bcmath \
intl \
mysqli \
pcntl \
pdo_mysql \
pdo_pgsql \
pgsql \
soap \
sockets \
zip \
&& yes '' | pecl install apcu event memcached yaml \
# opcache ships as a shared module on 8.3 and isn't enabled by upstream
&& docker-php-ext-enable apcu memcached yaml sodium opcache \
# event must load after sockets, hence the zz- prefix
&& docker-php-ext-enable --ini-name zz-docker-php-ext-event.ini event \
&& apk del --no-network .build-deps \
&& rm -rf /tmp/pear ~/.pearrc

COPY php/conf.d/*.ini $PHP_INI_DIR/conf.d/

WORKDIR /srv

# Restore the historical empty-entrypoint behaviour of this image
ENTRYPOINT []

ARG BUILD_DATE
ARG VCS_REF

LABEL org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.build-date=$BUILD_DATE
12 changes: 12 additions & 0 deletions 8.3/debug.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM graze/php-alpine:8.3

# The base image is built FROM php:8.3-cli-alpine which ships phpdbg as
# part of the PHP build, so no extra packages are needed for the test
# variant. This Dockerfile exists so we still produce a separate
# graze/php-alpine:8.3-test tag.

ARG BUILD_DATE
ARG VCS_REF

LABEL org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.build-date=$BUILD_DATE
64 changes: 64 additions & 0 deletions 8.3/php.bats
Original file line number Diff line number Diff line change
@@ -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"* ]]
}
3 changes: 3 additions & 0 deletions 8.3/php/conf.d/00_memlimit.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit = 1024M
13 changes: 13 additions & 0 deletions 8.3/php/conf.d/00_short_open_tag.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
; This directive determines whether or not PHP will recognize code between
; <? and ?> 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 <?php and ?> 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
9 changes: 9 additions & 0 deletions 8.3/php_debug.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bats

@test "the image has phpdbg" {
run docker run ${container} which phpdbg
echo 'status:' $status
echo 'output:' $output
[ "$status" -eq 0 ]
[[ "${output}" == *"phpdbg"* ]]
}
13 changes: 13 additions & 0 deletions 8.3/tags.bats
Original file line number Diff line number Diff line change
@@ -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)"* ]]
}
1 change: 1 addition & 0 deletions 8.4/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.bats
Loading