Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Opinionated PHP Docker images

License

NotificationsYou must be signed in to change notification settings

WyriHaximusNet/docker-php

Repository files navigation

AlpineDocker hubDocker hubDocker hub

Images

This repo builds two different images, plus a-dev image for each containingcomposer,bash, git, ssh, strace, gdb, and make, and a-root image for all*(-dev) images where the default user is root. All the imagesare based onAlpine Linux andDebian Linux. All images come withextensions used to increase the performance ofReactPHP (such as event loop extensions). Such extensionsare highlightedbuild in the extensions list below. All theAlpine Linux images are scanned for vulnerabilities, and not pushedif any are found. TheDebian Linux containers easily a few hundred so those aren't scanned. (There is no use in doing so.)

Images News

Sometimes big changes happen to images, to stay informed please subscribe to this thread:#46

CVE Matrix

Currently Alpine and Debian images are treated differently, this matrix defines the differences between Alpine and Debian images:

Base ImageDescription
AlpineDon't push when CVE's are found when building
DebianNot scanned for CVE's due to the ton of low CVE's found in there

The available tags

The docker registry prefix iswyrihaximusnet/php, thuswyrihaximusnet/php:OUR-TAGS

In order to provide upgrade path we intend to keep one or more versions of PHP.

Currently Available tags on Docker hub

The tag naming strategy consists of (Read as a regex):

  • PHP:(phpMajor).(phpMinor)-(nts|zts)-(alpine((alpineMajor).(alpineMinor))|bullseye|buster|strech)(-slim)(-dev)(-root)?
    • Example:8.2-zts-alpine-slim,8.4-nts-alpine3.13-dev,8.1-zts-buster-slim

Example usage

The following example has two build staging, the first for leading in any required dependencies, and the second theactual image we'd want to use. In the second stage we copy the dependencies in without needing composer in theproduction image. We create the image with the following command:

docker build. -t IMAGE_NAME:TAG --target=runtime
FROM ghcr.io/wyrihaximusnet/php:8.4-zts-alpine-slim-dev AS install-dependenciesWORKDIR /opt/appCOPY ./composer.lock /opt/app/composer.lockCOPY ./composer.json /opt/app/composer.jsonCOPY ./src/ /opt/app/src/RUN composer install --ansi --no-interaction --prefer-dist --no-dev -oFROM ghcr.io/wyrihaximusnet/php:8.4-zts-alpine-slim AS runtimeWORKDIR /opt/appCOPY ./composer.lock /opt/app/composer.lockCOPY ./composer.json /opt/app/composer.jsonCOPY --from=install-dependencies /opt/app/vendor/ /opt/app/vendor/COPY ./src/ /opt/app/src/COPY ./app.php /opt/app/app.phpENTRYPOINT ["php","/opt/app/app.php"]

NTS

NTS, or non-thread safe is the PHP version most people use. This image comes with the following extensions:

ExtensionDescription
ext-eioProvides interface to the libeio library
ext-pcntlPCNTL OS signals
ext-uvLibUV event loop
ext-eventLibevent event loop

ZTS

ZTS, or zend thread safe is the PHP version that is safe to be used and required my threading extensions such aspthreads or parallel. This image comes with the following extensions:

ExtensionDescription
ext-eioProvides interface to the libeio library
ext-parallelA succinct parallel concurrency API for PHP7 using threads
ext-pcntlPCNTL OS signals
ext-uvLibUV event loop

Both versions come with the following list of non-non-blocking related (core-) extensions:

  • bcmath
  • Core
  • ctype
  • curl
  • date
  • dom
  • ffi
  • fileinfo
  • filter
  • ftp
  • gd
  • gmp
  • grpc
  • hash
  • iconv
  • json
  • libxml
  • mbstring
  • mysqlnd
  • openssl
  • opentelemetry
  • pcre
  • PDO
  • pdo_pgsql
  • pdo_sqlite
  • pgsql
  • Phar
  • posix
  • random
  • readline
  • Reflection
  • session
  • SimpleXML
  • sodium
  • SPL
  • sqlite3
  • standard
  • tokenizer
  • vips
  • xml
  • xmlreader
  • xmlwriter
  • zip
  • zlib

Slim images

Slim images include all the above extensions except the following, as those notoriously require heavy dependencies:

  • gd
  • vips

Installing extensions

These images come with bothPECL andPIE for any additional extension needs.

Credits

This project is based onUsabilla'sPHP Docker Template.Lots of the documentation on that repository also applies here, with the big difference that this project onlysupplies CLI images.

Sponsor this project

 

Packages

 
 
 

Contributors4

  •  
  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp