Skip to content

Commit

Permalink
feat: 8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jorge07 committed Jul 21, 2023
1 parent 72e95d0 commit c8c6842
Show file tree
Hide file tree
Showing 14 changed files with 220 additions and 55 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: ["7.4", "8.0", "8.1" ]
version: [ "8.0", "8.1", "8.2" ]

name: ${{ matrix.version }}
runs-on: ubuntu-latest
Expand All @@ -22,13 +22,16 @@ jobs:
uses: docker/setup-qemu-action@master
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@master
- uses: azure/docker-login@v1
with:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build
run: |
docker buildx create --name alpine-php
docker buildx use alpine-php
docker buildx inspect --bootstrap
ARCHS="linux/arm64" make build
docker manifest inspect -v jorge07/alpine-php:${VERSION}
- name: Run
run: |
make run-detached
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ jobs:
strategy:
fail-fast: true
matrix:
version: [ "7.4", "8.0", "8.1" ]
version: [ "8.0", "8.1", "8.2" ]
arch: ["amd64", "arm64/v8", "arm/v7"]
env:
VERSION: ${{ matrix.version }}
ARCHS: linux/${{ matrix.arch }}
name: release-${{ matrix.version }}
runs-on: ubuntu-latest
steps:
Expand Down
83 changes: 83 additions & 0 deletions 8.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
FROM --platform=$BUILDPLATFORM alpine:edge as main

LABEL maintainer="Jorge Arco <jorge.arcoma@gmail.com>"

RUN apk --no-cache --repository https://dl-cdn.alpinelinux.org/alpine/edge/main add \
icu-libs \
&& apk --no-cache --repository https://dl-cdn.alpinelinux.org/alpine/edge/community add \
# Current packages don't exist in other repositories
libavif \
gnu-libiconv \
# Packages
tini \
php82 \
php82-dev \
php82-common \
php82-gd \
php82-xmlreader \
php82-bcmath \
php82-ctype \
php82-curl \
php82-exif \
php82-iconv \
php82-intl \
php82-mbstring \
php82-opcache \
php82-openssl \
php82-pcntl \
php82-phar \
php82-session \
php82-xml \
php82-xsl \
php82-zip \
php82-zlib \
php82-dom \
php82-fpm \
php82-sodium \
php82-tokenizer \
# Iconv Fix
php82-pecl-apcu \
&& ln -sf /usr/bin/php82 /usr/bin/php

ADD rootfs /

ENTRYPOINT ["/sbin/tini", "--"]

CMD ["/usr/sbin/php-fpm82", "-R", "--nodaemonize"]

EXPOSE 9000

WORKDIR /app

FROM --platform=$BUILDPLATFORM main as dev

ARG USER=root
ARG PASSWORD=root

ARG COMPOSER_VERSION=2.5.1

RUN apk add -U --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ \
php82-pear \
openssh \
supervisor \
autoconf \
git \
curl \
wget \
make \
zip \
php82-xdebug \
# Delete APK cache.
&& rm -rf /var/cache/apk/* \
# Create ssh user for dev.
&& sed -i s/#PermitRootLogin.*/PermitRootLogin\ yes/ /etc/ssh/sshd_config \
&& echo "${USER}:${PASSWORD}" | chpasswd \
&& ssh-keygen -A \
# Download composer.
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer --version=${COMPOSER_VERSION}

ADD devfs /

CMD ["supervisord", "--nodaemon", "--configuration", "/etc/supervisord/conf.d/supervisord.conf"]

EXPOSE 22 9003
11 changes: 11 additions & 0 deletions 8.2/devfs/etc/php82/conf.d/00_opcache.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
zend_extension=opcache.so

opcache.memory_consumption=256
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.revalidate_freq=2
opcache.fast_shutdown=1
opcache.enable_cli=1
opcache.enable=1
opcache.validate_timestamps=1
opcache.max_wasted_percentage=10
11 changes: 11 additions & 0 deletions 8.2/devfs/etc/php82/conf.d/00_xdebug.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
zend_extension=xdebug.so

xdebug.mode=debug
xdebug.log_level=0

xdebug.start_with_request=yes
xdebug.client_host=${XDEBUG_CLIENT_HOST}
xdebug.max_nesting_level=250

xdebug.var_display_max_data=10000
xdebug.var_display_max_depth=20
6 changes: 6 additions & 0 deletions 8.2/devfs/etc/php82/conf.d/50_settings.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
date.timezone = "UTC"
short_open_tag = Off
session.auto_start = Off
magic_quotes_gpc = Off
register_globals = Off
memory_limit = 1G
19 changes: 19 additions & 0 deletions 8.2/devfs/etc/profile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export CHARSET=UTF-8
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
export PAGER=less
export PS1='\h:\w\$ '

umask 022

alias xon='mv /tmp/00_xdebug.ini /etc/php82/conf.d/'
alias xoff='mv /etc/php82/conf.d/00_xdebug.ini /tmp'
alias opcon='mv /tmp/00_opcache.ini /etc/php82/conf.d/'
alias opcoff='mv /etc/php82/conf.d/00_opcache.ini /tmp'

alias profile='XDEBUG_CONFIG="profiler_enable=1 xdebug.profiler_output_name=profiler.out.%p profiler_output_dir=." php'

for script in /etc/profile.d/*.sh ; do
if [ -r $script ] ; then
. $script
fi
done
13 changes: 13 additions & 0 deletions 8.2/devfs/etc/supervisord/conf.d/supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[supervisord]
nodaemon=true
logfile=/var/log/supervisord.log
pidfile=/var/run/supervisord.pid

loglevel=debug
user=root

[program:fpm]
command=/usr/sbin/php-fpm82 -R --nodaemonize

[program:ssh]
command=/usr/sbin/sshd -D
11 changes: 11 additions & 0 deletions 8.2/rootfs/etc/php82/conf.d/00_opcache.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
zend_extension=opcache.so

opcache.memory_consumption=256
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=50000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli=1
opcache.enable=1
opcache.validate_timestamps=0
opcache.max_wasted_percentage=10
9 changes: 9 additions & 0 deletions 8.2/rootfs/etc/php82/conf.d/50_settings.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
date.timezone = "UTC"
short_open_tag = Off
session.auto_start = Off
magic_quotes_gpc = Off
register_globals = Off
memory_limit = 256M

realpath_cache_size=4096K
realpath_cache_ttl=600
36 changes: 36 additions & 0 deletions 8.2/rootfs/etc/php82/php-fpm.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[global]
emergency_restart_threshold = 10
emergency_restart_interval = 1m
process_control_timeout = 10
error_log = /proc/self/fd/2

[www]
user = root
group = root
listen = [::]:9000
chdir = /app

access.log = /proc/self/fd/1

pm = dynamic
pm.max_children = 500
pm.start_servers = 60
pm.min_spare_servers = 25
pm.max_spare_servers = 100
pm.max_requests = 1000

listen.backlog = -1
rlimit_files = 65536
rlimit_core = unlimited
catch_workers_output = yes
decorate_workers_output = no

request_slowlog_timeout = 5s
request_terminate_timeout = 120s
slowlog = /var/log/$pool.log.slow

pm.status_path = /fpm_status
ping.path = /fpm_ping
ping.response = pong

clear_env = no
42 changes: 5 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ Minimal PHP Docker images based on Alpine. Contains **tags** for development env

## Images

- [8.2](https://github.com/jorge07/alpine-php/blob/master/8.2/Dockerfile)
- [8.1](https://github.com/jorge07/alpine-php/blob/master/8.1/Dockerfile)
- [8.0](https://github.com/jorge07/alpine-php/blob/master/8.0/Dockerfile)

# Deprecated but available images

- [7.4](https://github.com/jorge07/alpine-php/blob/master/7.4/Dockerfile)
- [7.3](https://github.com/jorge07/alpine-php/blob/master/7.3/Dockerfile)
- [7.2](https://github.com/jorge07/alpine-php/blob/master/7.2/Dockerfile)
Expand All @@ -26,7 +30,7 @@ Minimal PHP Docker images based on Alpine. Contains **tags** for development env
## Usage:

```sh
docker run -d --name dev -p 2323:22 -v $PWD:/app jorge07/alpine-php:8.1-dev
docker run -d --name dev -p 2323:22 -v $PWD:/app jorge07/alpine-php:8.2-dev
```

> To make xdebug config easier for all environments there's a custom ENVVAR you can define: `XDEBUG_CLIENT_HOST`.
Expand All @@ -38,42 +42,6 @@ docker run -d --name dev -p 2323:22 -v $PWD:/app jorge07/alpine-php:8.1-dev

Dev images extend the standard ones and add some tools for development and CI like, composer, xdebug, etc...

| General purpose | Symfony | Wordpress
|---------------------|-------------|-------------------
| [8.1-dev](https://github.com/jorge07/alpine-php/blob/master/8.1/Dockerfile)| |
| [8.0-dev](https://github.com/jorge07/alpine-php/blob/master/8.0/Dockerfile)| |
| [7.4-dev](https://github.com/jorge07/alpine-php/blob/master/7.4/Dockerfile)| |
| [7.3-dev](https://github.com/jorge07/alpine-php/blob/master/7.3/Dockerfile) | |
| [7.2-dev](https://github.com/jorge07/alpine-php/blob/master/7.2/Dockerfile), | [7.2-dev-sf](https://github.com/jorge07/alpine-php/blob/symfony/7.2/Dockerfile.dev), [7.2-front-sf](https://github.com/jorge07/alpine-php/blob/symfony/7.2/Dockerfile.front) | [7.2-dev-wp](https://github.com/jorge07/alpine-php/blob/wordpress/7.2/Dockerfile.dev)
| [7.1-dev](https://github.com/jorge07/alpine-php/blob/master/7.1/Dockerfile.dev), [7.1-front](https://github.com/jorge07/alpine-php/blob/master/7.1/Dockerfile.front) | [7.1-dev-sf](https://github.com/jorge07/alpine-php/blob/symfony/7.1/Dockerfile.dev), [7.1-front-sf](https://github.com/jorge07/alpine-php/blob/symfony/7.1/Dockerfile.front) | [7.1-dev-wp](https://github.com/jorge07/alpine-php/blob/wordpress/7.1/Dockerfile.dev)
| [5.6-dev](https://github.com/jorge07/alpine-php/blob/master/5.6/Dockerfile.dev) | [5.6-dev-sf](https://github.com/jorge07/alpine-php/blob/symfony/5.6/Dockerfile.dev) | [5.6-dev-wp](https://github.com/jorge07/alpine-php/blob/wordpress/5.6/Dockerfile.dev)

## Content table

| Tag | Parent | Content | Image Layers
|------------|------------|-----------------------------------------------------------------------------------|---------
| 8.1 | alpine | tini, php8.1cli & fpm | [![](https://images.microbadger.com/badges/image/jorge07/alpine-php:8.1.svg)](https://microbadger.com/images/jorge07/alpine-php:8.1 "Get your own image badge on microbadger.com")
| 8.1-dev | 8.1 | + SSH server, xdebug, composer | [![](https://images.microbadger.com/badges/image/jorge07/alpine-php:8.1-dev.svg)](https://microbadger.com/images/jorge07/alpine-php:8.1-dev "Get your own image badge on microbadger.com")
| 8.0 | alpine | tini, php8-cli & fpm | [![](https://images.microbadger.com/badges/image/jorge07/alpine-php:8.0.svg)](https://microbadger.com/images/jorge07/alpine-php:8.0 "Get your own image badge on microbadger.com")
| 8.0-dev | 8.0 | + SSH server, xdebug, composer | [![](https://images.microbadger.com/badges/image/jorge07/alpine-php:8.0-dev.svg)](https://microbadger.com/images/jorge07/alpine-php:8.0-dev "Get your own image badge on microbadger.com")
| 7.4 | alpine | tini, php7.4-cli & fpm | [![](https://images.microbadger.com/badges/image/jorge07/alpine-php:7.4.svg)](https://microbadger.com/images/jorge07/alpine-php:7.4 "Get your own image badge on microbadger.com")
| 7.4-dev | 7.4 | + SSH server, xdebug, composer | [![](https://images.microbadger.com/badges/image/jorge07/alpine-php:7.4-dev.svg)](https://microbadger.com/images/jorge07/alpine-php:7.4-dev "Get your own image badge on microbadger.com")
| 7.3 | alpine | tini, php7.3-cli & fpm | [![](https://images.microbadger.com/badges/image/jorge07/alpine-php:7.3.svg)](https://microbadger.com/images/jorge07/alpine-php:7.3 "Get your own image badge on microbadger.com")
| 7.3-dev | 7.3 | + SSH server, xdebug, ant, composer | [![](https://images.microbadger.com/badges/image/jorge07/alpine-php:7.3-dev.svg)](https://microbadger.com/images/jorge07/alpine-php:7.3-dev "Get your own image badge on microbadger.com")
| 7.2 | alpine | tini, php7.2-cli & fpm | [![](https://images.microbadger.com/badges/image/jorge07/alpine-php:7.2.svg)](https://microbadger.com/images/jorge07/alpine-php:7.2 "Get your own image badge on microbadger.com")
| 7.2-dev | 7.2 | + SSH server, xdebug, composer | [![](https://images.microbadger.com/badges/image/jorge07/alpine-php:7.2-dev.svg)](https://microbadger.com/images/jorge07/alpine-php:7.2-dev "Get your own image badge on microbadger.com")
| 7.2-dev-sf | 7.2-dev | + [Symfony aliases](https://github.com/jorge07/alpine-php/blob/symfony/README.md) | [![](https://images.microbadger.com/badges/image/jorge07/alpine-php:7.2-dev-sf.svg)](https://microbadger.com/images/jorge07/alpine-php:7.2-dev-sf "Get your own image badge on microbadger.com")
| 7.2-front | 7.2-dev | + node6 & npm3 & yarn | [![](https://images.microbadger.com/badges/image/jorge07/alpine-php:7.2-front.svg)](https://microbadger.com/images/jorge07/alpine-php:7.2-front "Get your own image badge on microbadger.com")
| 7.1 | alpine | tini, php7.1-cli & fpm | [![](https://images.microbadger.com/badges/image/jorge07/alpine-php:7.1.svg)](https://microbadger.com/images/jorge07/alpine-php:7.1 "Get your own image badge on microbadger.com")
| 7.1-dev | 7.1 | + SSH server, xdebug, ant, composer | [![](https://images.microbadger.com/badges/image/jorge07/alpine-php:7.1-dev.svg)](https://microbadger.com/images/jorge07/alpine-php:7.1-dev "Get your own image badge on microbadger.com")
| 7-dev-sf | 7.1-dev | + [Symfony aliases](https://github.com/jorge07/alpine-php/blob/symfony/README.md) | [![](https://images.microbadger.com/badges/image/jorge07/alpine-php:7.1-dev-sf.svg)](https://microbadger.com/images/jorge07/alpine-php:7.1-dev-sf "Get your own image badge on microbadger.com")
| 7.1-front | 7.1-dev | + node6 & npm3 & yarn | [![](https://images.microbadger.com/badges/image/jorge07/alpine-php:7.1-front.svg)](https://microbadger.com/images/jorge07/alpine-php:7.1-front "Get your own image badge on microbadger.com")
| 5.6 | alpine | tini, php5.6-cli & fpm | [![](https://images.microbadger.com/badges/image/jorge07/alpine-php:5.6.svg)](https://microbadger.com/images/jorge07/alpine-php:5.6 "Get your own image badge on microbadger.com")
| 5.6-wp | 5.6 | + upload-volume | [![](https://images.microbadger.com/badges/image/jorge07/alpine-php:5.6-wp.svg)](https://microbadger.com/images/jorge07/alpine-php:5.6-wp "Get your own image badge on microbadger.com")
| 5.6-dev | 5.6 | + SSH server, xdebug, ant, composer | [![](https://images.microbadger.com/badges/image/jorge07/alpine-php:5.6-dev.svg)](https://microbadger.com/images/jorge07/alpine-php:5.6-dev "Get your own image badge on microbadger.com")
| 5.6-dev-sf | 5.6-dev | + [Symfony aliases](https://github.com/jorge07/alpine-php/blob/symfony/README.md) | [![](https://images.microbadger.com/badges/image/jorge07/alpine-php:5.6-dev-sf.svg)](https://microbadger.com/images/jorge07/alpine-php:5.6-dev-sf "Get your own image badge on microbadger.com")
| 5.6-dev-wp | 5.6-dev | + wp-cli, wp-autocompletion | [![](https://images.microbadger.com/badges/image/jorge07/alpine-php:5.6-dev-wp.svg)](https://microbadger.com/images/jorge07/alpine-php:5.6-dev-wp "Get your own image badge on microbadger.com")

## Contributors ✨

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
Expand Down
24 changes: 9 additions & 15 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
REPO:=jorge07/alpine-php
DOCKER_RUN:=docker run --rm -v $(PWD):/app ${REPO}:${VERSION}
DOCKER_RUN_DEV:=$(DOCKER_RUN)-dev
ARCHS:=linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v8
ARCHS:=linux/amd64

build:
docker buildx build --platform $(ARCHS) -t $(REPO):${VERSION} --target main -f ${VERSION}/Dockerfile ${VERSION}/
docker buildx build --platform $(ARCHS) -t $(REPO):${VERSION}-dev --target dev -f ${VERSION}/Dockerfile ${VERSION}/
docker buildx build --load --platform $(ARCHS) -t $(REPO):${VERSION} --target main -f ${VERSION}/Dockerfile ${VERSION}/
docker buildx build --load --platform $(ARCHS) -t $(REPO):${VERSION}-dev --target dev -f ${VERSION}/Dockerfile ${VERSION}/

run-detached:
docker run --name php${VERSION} -d -v $(PWD):/app $(REPO):${VERSION}
docker run --name php${VERSION}-dev -d -v $(PWD):/app $(REPO):${VERSION}-dev

test-main:
$(DOCKER_RUN) php -v
$(DOCKER_RUN) sh -c "php -v | grep ${VERSION}"
$(DOCKER_RUN) sh -c "php -v | grep OPcache"
$(DOCKER_RUN) sh -c "php test/test.php | grep Iyo"
$(DOCKER_RUN) sh -c "echo \"<?php echo ini_get('memory_limit');\" | php | grep 256M"

test-dev:
$(DOCKER_RUN_DEV) sh -c "php -v | grep Xdebug"
$(DOCKER_RUN_DEV) composer --version
Expand All @@ -33,21 +36,12 @@ release:
docker buildx build --platform $(ARCHS) --push -t $(REPO):${SEMVER}-dev --target dev -f ${VERSION}/Dockerfile ${VERSION}/

test-all: test-all
VERSION=8.2 make build
VERSION=8.1 make build
VERSION=8.0 make build
VERSION=7.4 make build
VERSION=7.3 make build
VERSION=7.2 make build
VERSION=7.1 make build
VERSION=8.2 make test-main
VERSION=8.1 make test-main
VERSION=8.0 make test-main
VERSION=7.4 make test-main
VERSION=7.3 make test-main
VERSION=7.2 make test-main
VERSION=7.1 make test-main
VERSION=8.2 make test-dev
VERSION=8.1 make test-dev
VERSION=8.0 make test-dev
VERSION=7.4 make test-dev
VERSION=7.3 make test-dev
VERSION=7.2 make test-dev
VERSION=7.1 make test-dev
Binary file added somefile.tar
Binary file not shown.

0 comments on commit c8c6842

Please sign in to comment.