Production Alpine PHP-FPM image with common extensions
1.9K
An Alpine-based production PHP-FPM image with common extensions and built-in healthcheck. Designed to work with an external web server (nginx, Apache, Caddy).
| Extension | Description |
|---|---|
pdo_mysql, mysqli | MySQL database |
pdo_pgsql | PostgreSQL database |
gd | Image processing (with WebP support) |
zip | Archive handling |
bcmath | Arbitrary precision math |
intl | Internationalization |
exif | Image metadata |
apcu | Opcode caching |
redis | Redis client |
Pre-installed in base image: curl, mbstring, opcache, pdo_sqlite, readline, sqlite3, xml
8.5, latest8.48.38.28.1docker pull tavib47/php-fpm:8.4
docker run -d -p 9000:9000 -v /path/to/app:/var/www/html tavib47/php-fpm:8.4
Then configure your web server to proxy PHP requests to localhost:9000.
services:
php:
image: tavib47/php-fpm:8.4
volumes:
- ./src:/var/www/html
expose:
- "9000"
healthcheck:
test: ["CMD", "php-fpm-healthcheck"]
interval: 30s
timeout: 3s
retries: 3
nginx:
image: nginx:alpine
ports:
- "80:80"
volumes:
- ./src:/var/www/html
- ./nginx.conf:/etc/nginx/conf.d/default.conf
depends_on:
php:
condition: service_healthy
server {
listen 80;
server_name example.com;
root /var/www/html/public;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass php:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
The image includes a built-in healthcheck:
# Check health manually
docker exec <container> php-fpm-healthcheck
# Available endpoints
# /status - PHP-FPM status page
# /ping - Simple ping endpoint
FROM tavib47/php-fpm:8.4
# Install additional extensions (example: imagick)
RUN apk add --no-cache --virtual .build-deps autoconf g++ make imagemagick-dev \
&& pecl install imagick \
&& docker-php-ext-enable imagick \
&& apk del .build-deps \
&& apk add --no-cache imagemagick
# Copy application code
COPY . /var/www/html
RUN chown -R www-data:www-data /var/www/html
Content type
Image
Digest
sha256:c9dd152db…
Size
332.4 MB
Last updated
8 months ago
docker pull tavib47/php-fpm