/docker-php-api

:whale: Docker Image for PHP API applications

Primary LanguageDockerfileMIT LicenseMIT

🐳 Docker PHP API

Docker Image for PHP API applications.

Alpine 3.15 + nginx 1.20 + PHP 8.1

FROM ghcr.io/shrink/docker-php-api:8
  • All requests are routed to public/index.php
  • xml and json responses are gzipped
  • nginx runs on port 8080
  • PHP-FPM status is exposed via /.container/status and /.container/ping
  • Available for PHP 7 ↓

See an example usage in Laravel Strict shrink/laravel-strict.

Immutability by Digest Pinning

Docker tags are mutable and could change the image represented at any time: in this project the version tag represents the PHP version included in the image, it does not represent an immutable version of the image itself. PHP version tags should be considered a discoverability aide, not an immutable image reference.

Most production use-cases are best served by Digest Pinning which uses the immutable image digest to guarantee reproducibility, e.g:

FROM ghcr.io/shrink/docker-php-api@sha256:7ea108539c53d2e601b17c23d9f3b0aacd627c3873eb1ef52187dd71a41ba061

PHP Versions

All Supported Versions of PHP are tagged with the major and minor version (e.g: 7 and 7.4).

FROM ghcr.io/shrink/docker-php-api:7

images.json is the manifest describing the images to be built by the CI. The GitHub Container Registry contains a full list of all built images with their tags and digests.

Credits

Optimized PHP-FPM configuration based on TrafeX/docker-php-nginx.