Docker image which provides everything to deploy PHP Applications. Includes PHP, Composer, npm
2.2K
This Docker image provides a fully featured development and runtime environment based on PHP 8.3.14-fpm. It is optimized for modern PHP applications, integrating necessary extensions, Composer, Node.js assets, and Quality Assurance tools.
It leverages mlocati/php-extension-installer for efficient extension management and combines system dependency installation to minimize image size.
| Component | Version | Description |
|---|---|---|
| OS / Base | Debian (via PHP image) | Official php:8.3.14-fpm base. |
| PHP | 8.3.14 | FastCGI Process Manager (FPM). |
| Composer | Latest | Copied from official composer:latest. |
| Node.js | Repository Version | Installed via apt. |
| Package Managers | npm, yarn | Yarn installed globally via npm. |
| Process Manager | PM2 | Node process manager installed globally. |
The following extensions are installed and configured:
bcmath, intl, pcntl, opcache, zippdo_mysqlgdxdebug (Configured via .docker/xdebug.ini)git - Version controlwget - Network downloaderzip / unzip - Archive handlingThe following PHAR archives are installed to /usr/local/bin/:
/var/www/html9000 (Standard PHP-FPM)/composerservices:
app:
build:
context: .
dockerfile: Dockerfile
volumes:
- ./:/var/www/html
ports:
- "9000:9000"
environment:
- PHP_IDE_CONFIG=serverName=localhost
This example demonstrates how to deploy this image in a Kubernetes environment (like k3s). It includes a Deployment for the pods and a Service to expose port 9000 internally.
Note: As this is a PHP-FPM container, it communicates via the FastCGI protocol. You will typically need an Nginx sidecar or an Ingress Controller that supports FastCGI (like Traefik or Nginx Ingress) to serve traffic to it.
apiVersion: apps/v1
kind: Deployment
metadata:
name: php-fpm-deployment
labels:
app: PhpFpmApp
spec:
replicas: 2
selector:
matchLabels:
app: PhpFpmApp
template:
metadata:
labels:
app: PhpFpmApp
spec:
containers:
- name: php-fpm-container
image: your-registry/php-fpm-image:latest
imagePullPolicy: Always
ports:
- containerPort: 9000
name: fastcgi
# Resource limits are recommended for production
resources:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "500m"
# Basic TCP check (since FPM does not speak HTTP natively)
livenessProbe:
tcpSocket:
port: 9000
initialDelaySeconds: 5
periodSeconds: 10
readinessProbe:
tcpSocket:
port: 9000
initialDelaySeconds: 5
periodSeconds: 10
---
apiVersion: v1
kind: Service
metadata:
name: php-fpm-service
spec:
selector:
app: PhpFpmApp
ports:
- protocol: TCP
port: 9000
targetPort: 9000
type: ClusterIP
Content type
Image
Digest
sha256:b95c5c888…
Size
71.6 MB
Last updated
10 months ago
docker pull jthegunner/php-composer-npm-amd