GithubHelp home page GithubHelp logo

wyrihaximusnet / docker-php Goto Github PK

View Code? Open in Web Editor NEW
38.0 3.0 6.0 437 KB

Opinionated PHP Docker images

Home Page: https://hub.docker.com/r/wyrihaximusnet/php

License: MIT License

Makefile 5.86% Shell 30.45% Python 23.68% PHP 40.01%
docker php parallel php7 reactphp uv hacktoberfest php8

docker-php's Introduction

Opinionated ReactPHP optimised PHP Docker images

Github Actions Docker hub Docker hub Docker hub

Images

This repo builds two different images, plus a -dev image for each containing composer, bash, git, ssh, strace, gdb, and make, and a -root image for all *(-dev) images where the default user is root. All the images are based on Alpine Linux and Debian Linux. All images come with extensions used to increase the performance of ReactPHP (such as event loop extensions). Such extensions are highlighted build in the extensions list below. All the Alpine Linux images are scanned for vulnerabilities, and not pushed if any are found. The Debian 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 Image Description
Alpine Don't push when CVE's are found when building
Debian Not scanned for CVE's due to the ton of low CVE's found in there

The available tags

The docker registry prefix is wyrihaximusnet/php, thus wyrihaximusnet/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.3-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 the actual image we'd want to use. In the second stage we copy the dependencies in without needing composer in the production image. We create the image with the following command:

docker build . -t IMAGE_NAME:TAG --target=runtime
FROM ghcr.io/wyrihaximusnet/php:8.3-zts-alpine-slim-dev AS install-dependencies

WORKDIR /opt/app

COPY ./composer.lock /opt/app/composer.lock
COPY ./composer.json /opt/app/composer.json
COPY ./src/ /opt/app/src/
RUN composer install --ansi --no-interaction --prefer-dist --no-dev -o

FROM ghcr.io/wyrihaximusnet/php:8.3-zts-alpine-slim AS runtime

WORKDIR /opt/app

COPY ./composer.lock /opt/app/composer.lock
COPY ./composer.json /opt/app/composer.json
COPY --from=install-dependencies /opt/app/vendor/ /opt/app/vendor/
COPY ./src/ /opt/app/src/
COPY ./app.php /opt/app/app.php

ENTRYPOINT ["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:

Extension Description
ext-eio Provides interface to the libeio library
ext-pcntl PCNTL OS signals
ext-uv LibUV event loop
ext-event Libevent event loop

ZTS

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

Extension Description
ext-eio Provides interface to the libeio library
ext-parallel A succinct parallel concurrency API for PHP7 using threads
ext-pcntl PCNTL OS signals
ext-uv LibUV event loop

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

  • bcmath
  • Core
  • ctype
  • curl
  • date
  • dom
  • fileinfo
  • filter
  • ftp
  • gd
  • gmp
  • hash
  • iconv
  • json
  • libxml
  • mbstring
  • mysqlnd
  • openssl
  • pcre
  • PDO
  • pdo_pgsql
  • pdo_sqlite
  • pgsql
  • Phar
  • posix
  • 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

Credits

This project is based on Usabilla's PHP Docker Template. Lots of the documentation on that repository also applies here, with the big difference that this project only supplies CLI images.

docker-php's People

Contributors

coderabbi avatar renovate[bot] avatar wyrihaximus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

docker-php's Issues

Automated builds

Please consider using automated builds for these images, so that people can somewhat trust that contents of this repository corresponds to images on Docker Hub.
I'd like to use this, but will not unless it is an automated build.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

dockerfile
Dockerfile-nts-alpine
  • php 7.4-cli-alpine3.11
  • composer 2
  • composer 2
Dockerfile-nts-debian
  • php 7.4-cli-buster
  • composer 2
  • composer 2
Dockerfile-zts-alpine
  • php 7.4-zts-alpine3.11
  • composer 2
  • composer 2
Dockerfile-zts-debian
  • php 7.4-zts-buster
  • composer 2
  • composer 2
github-actions
.github/workflows/alpine.yml
  • wyrihaximus/github-action-supported-alpine-linux-versions v1
.github/workflows/ci.yml
  • wyrihaximus/github-action-supported-php-versions v1
  • actions/checkout v4
  • actions/checkout v4
  • actions/checkout v4
  • actions/checkout v4
  • actions/checkout v4
  • actions/checkout v4
  • nick-invision/retry v3
  • actions/upload-artifact v4
  • actions/checkout v4
  • actions/download-artifact v4
  • actions/checkout v4
  • actions/download-artifact v4
  • actions/checkout v4
  • docker/setup-qemu-action v3
  • docker/setup-buildx-action v3
  • actions/download-artifact v4
  • nick-invision/retry v3
  • nick-invision/retry v3
  • nick-invision/retry v3
.github/workflows/debian.yml
  • wyrihaximus/github-action-supported-debian-linux-versions v1

  • Check this box to trigger a request for Renovate to run again on this repository

FPM tags

Hi @WyriHaximus,

In the documentation fpm is mentioned, but in the tags I can't seem to find a tag for fpm on docker hub.
Hopefully, you can help me further.

Cheers,

Frank

PHP 7.4?

Any idea when PHP 7.4 will be added to the docker image?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.