Sign inSign up

tavib47/php-fpm

By tavib47

•Updated 8 months ago

Production Alpine PHP-FPM image with common extensions

Image
Languages & frameworks
0

1.9K

tavib47/php-fpm repository overview

⁠PHP-FPM Production Image

Docker Hub Image Size

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).

⁠Features

  • PHP-FPM with production configuration
  • Built-in healthcheck via php-fpm-healthcheck⁠
  • Tuned opcache settings for production/Drupal workloads
  • Common PHP extensions for web applications
⁠PHP Extensions
ExtensionDescription
pdo_mysql, mysqliMySQL database
pdo_pgsqlPostgreSQL database
gdImage processing (with WebP support)
zipArchive handling
bcmathArbitrary precision math
intlInternationalization
exifImage metadata
apcuOpcode caching
redisRedis client

Pre-installed in base image: curl, mbstring, opcache, pdo_sqlite, readline, sqlite3, xml

⁠Supported Tags

  • 8.5, latest
  • 8.4
  • 8.3
  • 8.2
  • 8.1

⁠Quick Start

docker 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.

⁠Docker Compose Example

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

⁠Nginx Configuration Example

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;
    }
}

⁠Healthcheck

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

⁠Extending the Image

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

⁠Source

GitHub Repository⁠

Tag summary

Content type

Image

Digest

sha256:c9dd152db…

Size

332.4 MB

Last updated

8 months ago

docker pull tavib47/php-fpm