Merge pull request #94 from chialab/feat/add-amqp-gettext-imagick

Add amqp, gettext and imagick extensions. Use local registry to test images before pushing to DockerHub and GitHub Registry.
This commit is contained in:
le0m
2022-04-22 14:28:11 +02:00
committed by GitHub
10 changed files with 130 additions and 86 deletions
+66 -43
View File
@@ -8,7 +8,6 @@ on:
types: [opened, synchronize]
jobs:
docker:
name: Build, test and publish
runs-on: ubuntu-latest
@@ -20,14 +19,22 @@ jobs:
include:
- version: 'latest'
flavor: ''
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
driver-opts: network=host
- name: Build image for testing
uses: docker/build-push-action@v2
@@ -36,15 +43,47 @@ jobs:
cache-to: type=inline
context: .
build-args: |
BASE_IMAGE=${{ matrix.version }}${{ matrix.flavor }}
tags: chialab/php:${{ matrix.version }}${{ matrix.flavor }}
load: true
BASE_IMAGE=php:${{ matrix.version }}${{ matrix.flavor }}
tags: localhost:5000/chialab/php:${{ matrix.version }}${{ matrix.flavor }}
push: true
- name: Test image
env:
REGISTRY: localhost:5000/
VERSION: ${{ matrix.version }}${{ matrix.flavor }}
run: |
make test VERSION=${VERSION}
run: 'docker pull localhost:5000/chialab/php:${{ matrix.version }}${{ matrix.flavor }} && make test'
- name: Build dev image for testing
uses: docker/build-push-action@v2
with:
cache-to: type=inline
context: ./dev
build-args: |
BASE_IMAGE=localhost:5000/chialab/php:${{ matrix.version }}${{ matrix.flavor }}
tags: localhost:5000/chialab/php-dev:${{ matrix.version }}${{ matrix.flavor }}
push: true
- name: Test dev image
env:
REGISTRY: localhost:5000/
VERSION: ${{ matrix.version }}${{ matrix.flavor }}
run: 'docker pull localhost:5000/chialab/php-dev:${{ matrix.version }}${{ matrix.flavor }} && make -C dev test'
- name: Build xhprof image for testing
uses: docker/build-push-action@v2
with:
cache-to: type=inline
context: ./xhprof
build-args: |
BASE_IMAGE=localhost:5000/chialab/php:${{ matrix.version }}${{ matrix.flavor }}
tags: localhost:5000/chialab/php-xhprof:${{ matrix.version }}${{ matrix.flavor }}
push: true
- name: Test xhprof image
env:
REGISTRY: localhost:5000/
VERSION: ${{ matrix.version }}${{ matrix.flavor }}
run: 'docker pull localhost:5000/chialab/php-xhprof:${{ matrix.version }}${{ matrix.flavor }} && make -C xhprof test'
- name: Login to DockerHub
if: "github.event_name != 'pull_request'"
@@ -53,6 +92,14 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
if: "github.event_name != 'pull_request'"
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image and push to registry
if: "github.event_name != 'pull_request'"
uses: docker/build-push-action@v2
@@ -62,25 +109,12 @@ jobs:
cache-to: type=inline
context: .
build-args: |
BASE_IMAGE=${{ matrix.version }}${{ matrix.flavor }}
tags: chialab/php:${{ matrix.version }}${{ matrix.flavor }}
BASE_IMAGE=php:${{ matrix.version }}${{ matrix.flavor }}
tags:
chialab/php:${{ matrix.version }}${{ matrix.flavor }}
ghcr.io/chialab/php:${{ matrix.version }}${{ matrix.flavor }}
push: true
- name: Build dev image for testing
uses: docker/build-push-action@v2
with:
cache-to: type=inline
context: ./dev
build-args: |
BASE_IMAGE=${{ matrix.version }}${{ matrix.flavor }}
tags: chialab/php-dev:${{ matrix.version }}${{ matrix.flavor }}
load: true
- name: Test dev image
env:
VERSION: ${{ matrix.version }}${{ matrix.flavor }}
run: make -C dev test VERSION=${VERSION}
- name: Build dev image and push to registry
if: "github.event_name != 'pull_request'"
uses: docker/build-push-action@v2
@@ -89,25 +123,12 @@ jobs:
cache-to: type=inline
context: ./dev
build-args: |
BASE_IMAGE=${{ matrix.version }}${{ matrix.flavor }}
tags: chialab/php-dev:${{ matrix.version }}${{ matrix.flavor }}
BASE_IMAGE=ghcr.io/chialab/php:${{ matrix.version }}${{ matrix.flavor }}
tags: |
chialab/php-dev:${{ matrix.version }}${{ matrix.flavor }}
ghcr.io/chialab/php-dev:${{ matrix.version }}${{ matrix.flavor }}
push: true
- name: Build xhprof image for testing
uses: docker/build-push-action@v2
with:
cache-to: type=inline
context: ./xhprof
build-args: |
BASE_IMAGE=${{ matrix.version }}${{ matrix.flavor }}
tags: chialab/php-xhprof:${{ matrix.version }}${{ matrix.flavor }}
load: true
- name: Test xhprof image
env:
VERSION: ${{ matrix.version }}${{ matrix.flavor }}
run: make -C xhprof test VERSION=${VERSION}
- name: Build xhprof image (amd64 only) and push to registry
if: "github.event_name != 'pull_request'"
uses: docker/build-push-action@v2
@@ -115,6 +136,8 @@ jobs:
cache-to: type=inline
context: ./xhprof
build-args: |
BASE_IMAGE=${{ matrix.version }}${{ matrix.flavor }}
tags: chialab/php-xhprof:${{ matrix.version }}${{ matrix.flavor }}
BASE_IMAGE=ghcr.io/chialab/php:${{ matrix.version }}${{ matrix.flavor }}
tags: |
chialab/php-xhprof:${{ matrix.version }}${{ matrix.flavor }}
ghcr.io/chialab/php-xhprof:${{ matrix.version }}${{ matrix.flavor }}
push: true
+5 -2
View File
@@ -1,5 +1,5 @@
ARG BASE_IMAGE=latest
FROM php:${BASE_IMAGE}
ARG BASE_IMAGE=php:latest
FROM ${BASE_IMAGE}
LABEL maintainer="dev@chialab.io"
# Download script to install PHP extensions and dependencies
@@ -14,11 +14,14 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update -q \
zip unzip \
# iconv, mbstring and pdo_sqlite are omitted as they are already installed
&& PHP_EXTENSIONS=" \
amqp \
bcmath \
bz2 \
calendar \
exif \
gd \
gettext \
imagick \
intl \
ldap \
memcached \
+16 -13
View File
@@ -9,13 +9,16 @@ PHP_VERSION = $(firstword $(subst -, ,$(VERSION)))
# Extensions.
EXTENSIONS := \
amqp \
bcmath \
bz2 \
calendar \
exif \
iconv \
intl \
gd \
gettext \
iconv \
imagick \
intl \
ldap \
mbstring \
memcached \
@@ -39,21 +42,21 @@ ifeq (,$(findstring $(PHP_VERSION), 7.0 7.1 7.2 7.3 7.4 8.0 8.1 latest))
endif
build:
@echo " =====> Building $(IMAGE):$(VERSION)..."
docker image build --quiet --build-arg 'BASE_IMAGE=$(VERSION)' -t $(IMAGE):$(VERSION) .
@echo " =====> Building $(REGISTRY)$(IMAGE):$(VERSION)..."
docker image build --quiet --build-arg 'BASE_IMAGE=$(PARENT_IMAGE):$(VERSION)' -t $(REGISTRY)$(IMAGE):$(VERSION) .
test:
@echo -e "=====> Testing loaded extensions... \c"
@if [[ -z `docker image ls $(IMAGE) | grep "\s$(VERSION)\s"` ]]; then \
@if [[ -z `docker image ls $(REGISTRY)$(IMAGE) | grep "\s$(VERSION)\s"` ]]; then \
echo 'FAIL [Missing image!!!]'; \
exit 1; \
fi
@IMAGE_PHP_VERSION=`docker container run --rm $(IMAGE):$(VERSION) bash -c '/bin/echo $$PHP_VERSION' | cut -d '.' -f 1,2`; \
@IMAGE_PHP_VERSION=`docker container run --rm $(REGISTRY)$(IMAGE):$(VERSION) bash -c '/bin/echo $$PHP_VERSION' | cut -d '.' -f 1,2`; \
if [[ "$(PHP_VERSION)" != "latest" && "$${IMAGE_PHP_VERSION}" != "$(PHP_VERSION)" ]]; then \
echo "FAIL [wrong PHP version: expected $(PHP_VERSION), got $${IMAGE_PHP_VERSION}]"; \
exit 1; \
fi
@modules=`docker container run --rm $(IMAGE):$(VERSION) php -m`; \
@modules=`docker container run --rm $(REGISTRY)$(IMAGE):$(VERSION) php -m`; \
for ext in $(EXTENSIONS); do \
if [[ "$${modules}" != *"$${ext}"* ]]; then \
echo "FAIL [$${ext}]"; \
@@ -61,29 +64,29 @@ test:
fi \
done
@if [[ "$(VERSION)" == *'-apache' ]]; then \
apache=`docker container run --rm $(IMAGE):$(VERSION) apache2ctl -M 2> /dev/null`; \
apache=`docker container run --rm $(REGISTRY)$(IMAGE):$(VERSION) apache2ctl -M 2> /dev/null`; \
if [[ "$${apache}" != *'rewrite_module'* ]]; then \
echo 'FAIL [mod_rewrite]'; \
exit 1; \
fi \
fi
@if [[ -z `docker container run --rm $(IMAGE):$(VERSION) composer --version 2> /dev/null | grep '^Composer version 2\.[0-9][0-9]*'` ]]; then \
@if [[ -z `docker container run --rm $(REGISTRY)$(IMAGE):$(VERSION) composer --version 2> /dev/null | grep '^Composer version 2\.[0-9][0-9]*'` ]]; then \
echo 'FAIL [Composer 2]'; \
exit 1; \
fi
@if [[ -z `docker container run --rm $(IMAGE):$(VERSION) composer2 --version 2> /dev/null | grep '^Composer version 2\.[0-9][0-9]*'` ]]; then \
@if [[ -z `docker container run --rm $(REGISTRY)$(IMAGE):$(VERSION) composer2 --version 2> /dev/null | grep '^Composer version 2\.[0-9][0-9]*'` ]]; then \
echo 'FAIL [Composer 2]'; \
exit 1; \
fi
@if [[ -z `docker container run --rm $(IMAGE):$(VERSION) composer1 --version 2> /dev/null | grep '^Composer version 1\.[0-9][0-9]*'` ]]; then \
@if [[ -z `docker container run --rm $(REGISTRY)$(IMAGE):$(VERSION) composer1 --version 2> /dev/null | grep '^Composer version 1\.[0-9][0-9]*'` ]]; then \
echo 'FAIL [Composer 1]'; \
exit 1; \
fi
@if [[ -z `docker container run --rm $(IMAGE):$(VERSION) composer1 global show 2> /dev/null | grep '^hirak/prestissimo [0-9][0-9]*\.[0-9][0-9]*'` ]]; then \
@if [[ -z `docker container run --rm $(REGISTRY)$(IMAGE):$(VERSION) composer1 global show 2> /dev/null | grep '^hirak/prestissimo [0-9][0-9]*\.[0-9][0-9]*'` ]]; then \
echo 'FAIL [Composer 1 plugin - prestissimo]'; \
exit 1; \
fi
@echo 'OK'
push:
docker image push $(IMAGE):$(VERSION)
docker image push $(REGISTRY)$(IMAGE):$(VERSION)
+3
View File
@@ -57,12 +57,15 @@ As you might have guessed, all tags are built on top of the corresponding tag of
The following modules and extensions have been enabled,
in addition to those you can already find in the [official PHP image](https://hub.docker.com/r/_/php/):
- `amqp`
- `bcmath`
- `bz2`
- `calendar`
- `exif`
- `gd`
- `gettext`
- `iconv`
- `imagick`
- `intl`
- `ldap`
- `mbstring`
+2 -2
View File
@@ -1,5 +1,5 @@
ARG BASE_IMAGE=latest
FROM chialab/php:${BASE_IMAGE}
ARG BASE_IMAGE=chialab/php:latest
FROM ${BASE_IMAGE}
LABEL maintainer="dev@chialab.io"
# Install XDebug.
+16 -13
View File
@@ -9,13 +9,16 @@ PHP_VERSION = $(firstword $(subst -, ,$(VERSION)))
# Extensions.
EXTENSIONS := \
amqp \
bcmath \
bz2 \
calendar \
exif \
iconv \
intl \
gd \
gettext \
iconv \
imagick \
intl \
ldap \
mbstring \
memcached \
@@ -40,21 +43,21 @@ ifeq (,$(findstring $(PHP_VERSION), 7.0 7.1 7.2 7.3 7.4 8.0 8.1 latest))
endif
build:
@echo " =====> Building $(IMAGE):$(VERSION)..."
docker image build --quiet --build-arg 'BASE_IMAGE=$(VERSION)' -t $(IMAGE):$(VERSION) .
@echo " =====> Building $(REGISTRY)$(IMAGE):$(VERSION)..."
docker image build --quiet --build-arg 'BASE_IMAGE=$(PARENT_IMAGE):$(VERSION)' -t $(REGISTRY)$(IMAGE):$(VERSION) .
test:
@echo -e "=====> Testing loaded extensions... \c"
@if [[ -z `docker image ls $(IMAGE) | grep "\s$(VERSION)\s"` ]]; then \
@if [[ -z `docker image ls $(REGISTRY)$(IMAGE) | grep "\s$(VERSION)\s"` ]]; then \
echo 'FAIL [Missing image!!!]'; \
exit 1; \
fi
@IMAGE_PHP_VERSION=`docker container run --rm $(IMAGE):$(VERSION) bash -c '/bin/echo $$PHP_VERSION' | cut -d '.' -f 1,2`; \
@IMAGE_PHP_VERSION=`docker container run --rm $(REGISTRY)$(IMAGE):$(VERSION) bash -c '/bin/echo $$PHP_VERSION' | cut -d '.' -f 1,2`; \
if [[ "$(PHP_VERSION)" != "latest" && "$${IMAGE_PHP_VERSION}" != "$(PHP_VERSION)" ]]; then \
echo "FAIL [wrong PHP version: expected $(PHP_VERSION), got $${IMAGE_PHP_VERSION}]"; \
exit 1; \
fi
@modules=`docker container run --rm $(IMAGE):$(VERSION) php -m`; \
@modules=`docker container run --rm $(REGISTRY)$(IMAGE):$(VERSION) php -m`; \
for ext in $(EXTENSIONS); do \
if [[ "$${modules}" != *"$${ext}"* ]]; then \
echo "FAIL [$${ext}]"; \
@@ -62,29 +65,29 @@ test:
fi \
done
@if [[ "$(VERSION)" == *'-apache' ]]; then \
apache=`docker container run --rm $(IMAGE):$(VERSION) apache2ctl -M 2> /dev/null`; \
apache=`docker container run --rm $(REGISTRY)$(IMAGE):$(VERSION) apache2ctl -M 2> /dev/null`; \
if [[ "$${apache}" != *'rewrite_module'* ]]; then \
echo 'FAIL [mod_rewrite]'; \
exit 1; \
fi \
fi
@if [[ -z `docker container run --rm $(IMAGE):$(VERSION) composer --version 2> /dev/null | grep '^Composer version 2\.[0-9][0-9]*'` ]]; then \
@if [[ -z `docker container run --rm $(REGISTRY)$(IMAGE):$(VERSION) composer --version 2> /dev/null | grep '^Composer version 2\.[0-9][0-9]*'` ]]; then \
echo 'FAIL [Composer 2]'; \
exit 1; \
fi
@if [[ -z `docker container run --rm $(IMAGE):$(VERSION) composer2 --version 2> /dev/null | grep '^Composer version 2\.[0-9][0-9]*'` ]]; then \
@if [[ -z `docker container run --rm $(REGISTRY)$(IMAGE):$(VERSION) composer2 --version 2> /dev/null | grep '^Composer version 2\.[0-9][0-9]*'` ]]; then \
echo 'FAIL [Composer 2]'; \
exit 1; \
fi
@if [[ -z `docker container run --rm $(IMAGE):$(VERSION) composer1 --version 2> /dev/null | grep '^Composer version 1\.[0-9][0-9]*'` ]]; then \
@if [[ -z `docker container run --rm $(REGISTRY)$(IMAGE):$(VERSION) composer1 --version 2> /dev/null | grep '^Composer version 1\.[0-9][0-9]*'` ]]; then \
echo 'FAIL [Composer 1]'; \
exit 1; \
fi
@if [[ -z `docker container run --rm $(IMAGE):$(VERSION) composer1 global show 2> /dev/null | grep '^hirak/prestissimo [0-9][0-9]*\.[0-9][0-9]*'` ]]; then \
@if [[ -z `docker container run --rm $(REGISTRY)$(IMAGE):$(VERSION) composer1 global show 2> /dev/null | grep '^hirak/prestissimo [0-9][0-9]*\.[0-9][0-9]*'` ]]; then \
echo 'FAIL [Composer 1 plugin - prestissimo]'; \
exit 1; \
fi
@echo 'OK'
push:
docker image push $(IMAGE):$(VERSION)
docker image push $(REGISTRY)$(IMAGE):$(VERSION)
+3
View File
@@ -57,12 +57,15 @@ As you might have guessed, all tags are built on top of the corresponding tag of
The following modules and extensions have been enabled,
in addition to those you can already find in the [official PHP image](https://hub.docker.com/r/_/php/):
- `amqp`
- `bcmath`
- `bz2`
- `calendar`
- `exif`
- `gd`
- `gettext`
- `iconv`
- `imagick`
- `intl`
- `ldap`
- `mbstring`
+2 -2
View File
@@ -1,5 +1,5 @@
ARG BASE_IMAGE=latest
FROM chialab/php:${BASE_IMAGE}
ARG BASE_IMAGE=chialab/php:latest
FROM ${BASE_IMAGE}
LABEL maintainer="dev@chialab.io"
# Install XHProf.
+14 -11
View File
@@ -9,12 +9,15 @@ PHP_VERSION = $(firstword $(subst -, ,$(VERSION)))
# Extensions.
EXTENSIONS := \
amqp \
bcmath \
bz2 \
calendar \
exif \
gd \
gettext \
iconv \
imagick \
intl \
ldap \
mbstring \
@@ -40,21 +43,21 @@ ifeq (,$(findstring $(PHP_VERSION), 7.0 7.1 7.2 7.3 7.4 8.0 8.1 latest))
endif
build:
@echo " =====> Building $(IMAGE):$(VERSION)..."
docker image build --quiet --build-arg 'BASE_IMAGE=$(VERSION)' -t $(IMAGE):$(VERSION) .
@echo " =====> Building $(REGISTRY)$(IMAGE):$(VERSION)..."
docker image build --quiet --build-arg 'BASE_IMAGE=$(PARENT_IMAGE):$(VERSION)' -t $(REGISTRY)$(IMAGE):$(VERSION) .
test:
@echo -e "=====> Testing loaded extensions... \c"
@if [[ -z `docker image ls $(IMAGE) | grep "\s$(VERSION)\s"` ]]; then \
@if [[ -z `docker image ls $(REGISTRY)$(IMAGE) | grep "\s$(VERSION)\s"` ]]; then \
echo 'FAIL [Missing image!!!]'; \
exit 1; \
fi
@IMAGE_PHP_VERSION=`docker container run --rm $(IMAGE):$(VERSION) bash -c '/bin/echo $$PHP_VERSION' | cut -d '.' -f 1,2`; \
@IMAGE_PHP_VERSION=`docker container run --rm $(REGISTRY)$(IMAGE):$(VERSION) bash -c '/bin/echo $$PHP_VERSION' | cut -d '.' -f 1,2`; \
if [[ "$(PHP_VERSION)" != "latest" && "$${IMAGE_PHP_VERSION}" != "$(PHP_VERSION)" ]]; then \
echo "FAIL [wrong PHP version: expected $(PHP_VERSION), got $${IMAGE_PHP_VERSION}]"; \
exit 1; \
fi
@modules=`docker container run --rm $(IMAGE):$(VERSION) php -m`; \
@modules=`docker container run --rm $(REGISTRY)$(IMAGE):$(VERSION) php -m`; \
for ext in $(EXTENSIONS); do \
if [[ "$${modules}" != *"$${ext}"* ]]; then \
echo "FAIL [$${ext}]"; \
@@ -62,29 +65,29 @@ test:
fi \
done
@if [[ "$(VERSION)" == *'-apache' ]]; then \
apache=`docker container run --rm $(IMAGE):$(VERSION) apache2ctl -M 2> /dev/null`; \
apache=`docker container run --rm $(REGISTRY)$(IMAGE):$(VERSION) apache2ctl -M 2> /dev/null`; \
if [[ "$${apache}" != *'rewrite_module'* ]]; then \
echo 'FAIL [mod_rewrite]'; \
exit 1; \
fi \
fi
@if [[ -z `docker container run --rm $(IMAGE):$(VERSION) composer --version 2> /dev/null | grep '^Composer version 2\.[0-9][0-9]*'` ]]; then \
@if [[ -z `docker container run --rm $(REGISTRY)$(IMAGE):$(VERSION) composer --version 2> /dev/null | grep '^Composer version 2\.[0-9][0-9]*'` ]]; then \
echo 'FAIL [Composer 2]'; \
exit 1; \
fi
@if [[ -z `docker container run --rm $(IMAGE):$(VERSION) composer2 --version 2> /dev/null | grep '^Composer version 2\.[0-9][0-9]*'` ]]; then \
@if [[ -z `docker container run --rm $(REGISTRY)$(IMAGE):$(VERSION) composer2 --version 2> /dev/null | grep '^Composer version 2\.[0-9][0-9]*'` ]]; then \
echo 'FAIL [Composer 2]'; \
exit 1; \
fi
@if [[ -z `docker container run --rm $(IMAGE):$(VERSION) composer1 --version 2> /dev/null | grep '^Composer version 1\.[0-9][0-9]*'` ]]; then \
@if [[ -z `docker container run --rm $(REGISTRY)$(IMAGE):$(VERSION) composer1 --version 2> /dev/null | grep '^Composer version 1\.[0-9][0-9]*'` ]]; then \
echo 'FAIL [Composer 1]'; \
exit 1; \
fi
@if [[ -z `docker container run --rm $(IMAGE):$(VERSION) composer1 global show 2> /dev/null | grep '^hirak/prestissimo [0-9][0-9]*\.[0-9][0-9]*'` ]]; then \
@if [[ -z `docker container run --rm $(REGISTRY)$(IMAGE):$(VERSION) composer1 global show 2> /dev/null | grep '^hirak/prestissimo [0-9][0-9]*\.[0-9][0-9]*'` ]]; then \
echo 'FAIL [Composer 1 plugin - prestissimo]'; \
exit 1; \
fi
@echo 'OK'
push:
docker image push $(IMAGE):$(VERSION)
docker image push $(REGISTRY)$(IMAGE):$(VERSION)
+3
View File
@@ -57,12 +57,15 @@ As you might have guessed, all tags are built on top of the corresponding tag of
The following modules and extensions have been enabled,
in addition to those you can already find in the [official PHP image](https://hub.docker.com/r/_/php/):
- `amqp`
- `bcmath`
- `bz2`
- `calendar`
- `exif`
- `gd`
- `gettext`
- `iconv`
- `imagick`
- `intl`
- `ldap`
- `mbstring`