mirror of
https://github.com/chialab/docker-php.git
synced 2026-08-24 10:13:24 -05:00
Merge pull request #113 from chialab/feat/alpine-images
feat: Alpine flavor
This commit is contained in:
@@ -18,10 +18,12 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
version: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ]
|
||||
flavor: [ '', '-apache', '-fpm' ]
|
||||
flavor: [ '', '-apache', '-fpm', '-alpine', '-fpm-alpine' ]
|
||||
include:
|
||||
- version: 'latest'
|
||||
flavor: ''
|
||||
- version: 'alpine'
|
||||
flavor: ''
|
||||
services:
|
||||
registry:
|
||||
image: registry:2
|
||||
@@ -31,16 +33,13 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up QEMU
|
||||
run: |
|
||||
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
||||
|
||||
- name: Build image for testing
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
cache-from: type=registry,ref=chialab/php:${{ matrix.version }}${{ matrix.flavor }}
|
||||
cache-to: type=inline
|
||||
context: .
|
||||
file: ${{ ((contains(matrix.flavor, 'alpine') || matrix.version == 'alpine') && 'Dockerfile.alpine') || 'Dockerfile' }}
|
||||
build-args: |
|
||||
BASE_IMAGE=php:${{ matrix.version }}${{ matrix.flavor }}
|
||||
tags: localhost:5000/chialab/php:${{ matrix.version }}${{ matrix.flavor }}
|
||||
@@ -110,15 +109,12 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
version: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ]
|
||||
flavor: [ '', '-apache', '-fpm' ]
|
||||
flavor: [ '', '-apache', '-fpm', '-alpine', '-fpm-alpine' ]
|
||||
include:
|
||||
- version: 'latest'
|
||||
flavor: ''
|
||||
services:
|
||||
registry:
|
||||
image: registry:2
|
||||
ports:
|
||||
- 5000:5000
|
||||
- version: 'alpine'
|
||||
flavor: ''
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
@@ -152,6 +148,7 @@ jobs:
|
||||
cache-from: type=registry,ref=chialab/php:${{ matrix.version }}${{ matrix.flavor }}
|
||||
cache-to: type=inline
|
||||
context: .
|
||||
file: ${{ ((contains(matrix.flavor, 'alpine') || matrix.version == 'alpine') && 'Dockerfile.alpine') || 'Dockerfile' }}
|
||||
build-args: |
|
||||
BASE_IMAGE=php:${{ matrix.version }}${{ matrix.flavor }}
|
||||
tags: |
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
ARG BASE_IMAGE=php:alpine
|
||||
FROM ${BASE_IMAGE}
|
||||
LABEL maintainer="dev@chialab.io"
|
||||
|
||||
# Download script to install PHP extensions and dependencies
|
||||
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/install-php-extensions
|
||||
|
||||
RUN apk add --no-cache \
|
||||
coreutils \
|
||||
curl \
|
||||
git \
|
||||
zip unzip \
|
||||
# iconv, mbstring and pdo_sqlite are omitted as they are already installed
|
||||
&& PHP_EXTENSIONS=" \
|
||||
amqp \
|
||||
bcmath \
|
||||
bz2 \
|
||||
calendar \
|
||||
event \
|
||||
exif \
|
||||
gd \
|
||||
gettext \
|
||||
imagick \
|
||||
intl \
|
||||
ldap \
|
||||
memcached \
|
||||
mysqli \
|
||||
opcache \
|
||||
pdo_mysql \
|
||||
pdo_pgsql \
|
||||
pgsql \
|
||||
redis \
|
||||
soap \
|
||||
sockets \
|
||||
xsl \
|
||||
zip \
|
||||
" \
|
||||
&& case "$PHP_VERSION" in \
|
||||
5.6.*) PHP_EXTENSIONS="$PHP_EXTENSIONS mcrypt mysql";; \
|
||||
7.0.*|7.1.*) PHP_EXTENSIONS="$PHP_EXTENSIONS mcrypt";; \
|
||||
esac \
|
||||
&& install-php-extensions $PHP_EXTENSIONS \
|
||||
&& if command -v a2enmod; then a2enmod rewrite; fi
|
||||
|
||||
# Install Composer.
|
||||
ENV PATH=$PATH:/root/composer/vendor/bin \
|
||||
COMPOSER_ALLOW_SUPERUSER=1 \
|
||||
COMPOSER_HOME=/root/composer
|
||||
RUN cd /root \
|
||||
# Download installer and check for its integrity.
|
||||
&& curl -sSL https://getcomposer.org/installer > composer-setup.php \
|
||||
&& curl -sSL https://composer.github.io/installer.sha384sum > composer-setup.sha384sum \
|
||||
&& sha384sum --check composer-setup.sha384sum \
|
||||
# Install Composer 2.
|
||||
&& php composer-setup.php --install-dir=/usr/local/bin --filename=composer --2 \
|
||||
# Remove installer files.
|
||||
&& rm /root/composer-setup.php /root/composer-setup.sha384sum
|
||||
@@ -33,11 +33,11 @@ EXTENSIONS := \
|
||||
xsl \
|
||||
zip \
|
||||
sockets
|
||||
ifeq (,$(findstring $(PHP_VERSION), 7.2 7.3 7.4 8.0 8.1 8.2 latest))
|
||||
ifeq (,$(findstring $(PHP_VERSION), 7.2 7.3 7.4 8.0 8.1 8.2 latest alpine))
|
||||
# Add more extensions to PHP < 7.2.
|
||||
EXTENSIONS += mcrypt
|
||||
endif
|
||||
ifeq (,$(findstring $(PHP_VERSION), 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 latest))
|
||||
ifeq (,$(findstring $(PHP_VERSION), 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 latest alpine))
|
||||
# Add more extensions to 5.x series images.
|
||||
EXTENSIONS += mysql
|
||||
endif
|
||||
@@ -52,8 +52,8 @@ test:
|
||||
echo 'FAIL [Missing image!!!]'; \
|
||||
exit 1; \
|
||||
fi
|
||||
@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 \
|
||||
@IMAGE_PHP_VERSION=`docker container run --rm $(REGISTRY)$(IMAGE):$(VERSION) sh -c '/bin/echo $$PHP_VERSION' | cut -d '.' -f 1,2`; \
|
||||
if [[ "$(PHP_VERSION)" != "latest" && "$(PHP_VERSION)" != "alpine" && "$${IMAGE_PHP_VERSION}" != "$(PHP_VERSION)" ]]; then \
|
||||
echo "FAIL [wrong PHP version: expected $(PHP_VERSION), got $${IMAGE_PHP_VERSION}]"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
+4
-4
@@ -34,11 +34,11 @@ EXTENSIONS := \
|
||||
xsl \
|
||||
zip \
|
||||
sockets
|
||||
ifeq (,$(findstring $(PHP_VERSION), 7.2 7.3 7.4 8.0 8.1 8.2 latest))
|
||||
ifeq (,$(findstring $(PHP_VERSION), 7.2 7.3 7.4 8.0 8.1 8.2 latest alpine))
|
||||
# Add more extensions to PHP < 7.2.
|
||||
EXTENSIONS += mcrypt
|
||||
endif
|
||||
ifeq (,$(findstring $(PHP_VERSION), 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 latest))
|
||||
ifeq (,$(findstring $(PHP_VERSION), 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 latest alpine))
|
||||
# Add more extensions to 5.x series images.
|
||||
EXTENSIONS += mysql
|
||||
endif
|
||||
@@ -53,8 +53,8 @@ test:
|
||||
echo 'FAIL [Missing image!!!]'; \
|
||||
exit 1; \
|
||||
fi
|
||||
@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 \
|
||||
@IMAGE_PHP_VERSION=`docker container run --rm $(REGISTRY)$(IMAGE):$(VERSION) sh -c '/bin/echo $$PHP_VERSION' | cut -d '.' -f 1,2`; \
|
||||
if [[ "$(PHP_VERSION)" != "latest" && "$(PHP_VERSION)" != "alpine" && "$${IMAGE_PHP_VERSION}" != "$(PHP_VERSION)" ]]; then \
|
||||
echo "FAIL [wrong PHP version: expected $(PHP_VERSION), got $${IMAGE_PHP_VERSION}]"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
+3
-3
@@ -34,7 +34,7 @@ EXTENSIONS := \
|
||||
xsl \
|
||||
zip \
|
||||
sockets
|
||||
ifeq (,$(findstring $(PHP_VERSION), 7.2 7.3 7.4 8.0 8.1 8.2 latest))
|
||||
ifeq (,$(findstring $(PHP_VERSION), 7.2 7.3 7.4 8.0 8.1 8.2 latest alpine))
|
||||
# Add more extensions to PHP < 7.2.
|
||||
EXTENSIONS += mcrypt
|
||||
endif
|
||||
@@ -49,8 +49,8 @@ test:
|
||||
echo 'FAIL [Missing image!!!]'; \
|
||||
exit 1; \
|
||||
fi
|
||||
@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 \
|
||||
@IMAGE_PHP_VERSION=`docker container run --rm $(REGISTRY)$(IMAGE):$(VERSION) sh -c '/bin/echo $$PHP_VERSION' | cut -d '.' -f 1,2`; \
|
||||
if [[ "$(PHP_VERSION)" != "latest" && "$(PHP_VERSION)" != "alpine" && "$${IMAGE_PHP_VERSION}" != "$(PHP_VERSION)" ]]; then \
|
||||
echo "FAIL [wrong PHP version: expected $(PHP_VERSION), got $${IMAGE_PHP_VERSION}]"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
+4
-4
@@ -34,11 +34,11 @@ EXTENSIONS := \
|
||||
xhprof \
|
||||
xsl \
|
||||
zip
|
||||
ifeq (,$(findstring $(PHP_VERSION), 7.2 7.3 7.4 8.0 8.1 8.2 latest))
|
||||
ifeq (,$(findstring $(PHP_VERSION), 7.2 7.3 7.4 8.0 8.1 8.2 latest alpine))
|
||||
# Add more extensions to PHP < 7.2.
|
||||
EXTENSIONS += mcrypt
|
||||
endif
|
||||
ifeq (,$(findstring $(PHP_VERSION), 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 latest))
|
||||
ifeq (,$(findstring $(PHP_VERSION), 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 latest alpine))
|
||||
# Add more extensions to 5.x series images.
|
||||
EXTENSIONS += mysql
|
||||
endif
|
||||
@@ -53,8 +53,8 @@ test:
|
||||
echo 'FAIL [Missing image!!!]'; \
|
||||
exit 1; \
|
||||
fi
|
||||
@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 \
|
||||
@IMAGE_PHP_VERSION=`docker container run --rm $(REGISTRY)$(IMAGE):$(VERSION) sh -c '/bin/echo $$PHP_VERSION' | cut -d '.' -f 1,2`; \
|
||||
if [[ "$(PHP_VERSION)" != "latest" && "$(PHP_VERSION)" != "alpine" && "$${IMAGE_PHP_VERSION}" != "$(PHP_VERSION)" ]]; then \
|
||||
echo "FAIL [wrong PHP version: expected $(PHP_VERSION), got $${IMAGE_PHP_VERSION}]"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user