Skip to content

morsalin1342/php-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Production-Ready PHP Docker Images

Docker Pulls GitHub Stars License

High-performance, production-ready PHP-FPM and PHP-CLI Docker images, packed with extensions and tools to supercharge any modern PHP application.


✨ Why These Images?

  • Batteries Included: 50+ optimized PHP extensions, Composer, WP-CLI, and a configurable Node.js version (defaults to 24).
  • Production Optimized: Built on official php:bookworm bases with php.ini-production settings.
  • Multi-Version: Maintained builds for PHP 8.2, 8.3, 8.4, and 8.5.
  • CI/CD Ready: Lightweight and perfect for automated build pipelines.

🎯 Ideal For

These images are optimized for a wide range of PHP applications, including:

  • Laravel: Ready for queues, broadcasting, and Octane.
  • Symfony: All the necessary extensions for a full-featured Symfony project.
  • WordPress: Includes WP-CLI and all recommended PHP extensions.
  • Custom Applications: A solid foundation for any modern PHP project.

⚡ Quick Start

The recommended way to use these images is to reference them directly from Docker Hub in your docker-compose.yml or Dockerfile.

For Web Applications (FPM)

# docker-compose.yml
services:
  php:
    image: morsalin1342/php:8.4-fpm
    volumes:
      - ./src:/var/www/html

  nginx:
    image: nginx:alpine
    ports:
      - "8080:80"
    volumes:
      - ./src:/var/www/html
      - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro

For CLI Tasks

# Run Composer install
docker run --rm -v $(pwd):/app morsalin1342/php:8.4-cli composer install

# Run a specific PHP script
docker run --rm -v $(pwd):/app morsalin1342/php:8.4-cli php your-script.php

🛠️ Building Locally

If you need to customize the images, you can build them locally. This is useful for changing the Node.js version or adding build-time dependencies.

Clone the repository and use the --build-arg flag:

git clone https://github.com/morsalin1342/php-docker.git
cd php-docker

# Build a PHP 8.4 image with Node.js 22
docker build . \
  --build-arg PHP_VERSION=8.4 \
  --build-arg IMAGE_TYPE=fpm \
  --build-arg NODE_VERSION=22 \
  -t my-custom-php:8.4-fpm

📦 What's Inside?

PHP Extensions

We include everything you need for modern development:

  • Performance: apcu, opcache, redis, memcached, igbinary.
  • Databases: mysqli, pdo_mysql, pdo_pgsql, mongodb.
  • Async: swoole, amqp, pcntl, rdkafka, sockets.
  • Utility & Dev: gd, intl, imagick, pcov (for testing), and many more.

Essential Tools

  • Composer (Latest)
  • WP-CLI (WordPress command-line support)
  • Node.js (Configurable via build arg, defaults to v24)
  • System Tools: supervisor, cron, ffmpeg, zip/unzip.

🏷️ Tagging Strategy

We prioritize stability. Use explicit tags in your production Dockerfile:

Variant Use Case
morsalin1342/php:<version>-fpm Production Web Servers (includes Supervisor/Cron)
morsalin1342/php:<version>-cli Tasks, Migrations, CI/CD Pipelines

❓ FAQ

Q: Can I run custom php.ini configurations? A: Absolutely. You can mount your own php.ini file into the container:

    volumes:
      - ./php.ini:/usr/local/etc/php/php.ini:ro

Q: How do I add extensions not in your list? A: Since we use the mlocati/php-extension-installer utility, you can easily install any other extension via a custom Dockerfile layer:

FROM morsalin1342/php:8.4-fpm
RUN install-php-extensions my-custom-extension

Q: Why Node.js v24? A: We prioritize stability and long-term support. Node.js 24 is excellent for modern build tooling like Vite, Webpack, or TailwindCSS.

Q: How do I manage queues or background processes? A: The -fpm images include supervisor. You can mount your configuration in /etc/supervisor/conf.d/ to manage worker processes.


🤝 Contributing & Issues

Found a bug or need a specific extension?

Built with ❤️ by the community.

About

High-performance, production-ready PHP-FPM and PHP-CLI Docker images, built on top of official Docker/PHP images, packed with extensions and tools to supercharge any modern PHP application.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors