A ready-to-use container designed for running PHP-based applications, including Laravel microservices. This Docker image combines Nginx and PHP-FPM, offering a robust foundation for your projects with built-in support for essential extensions and configurations.
- PHP Application Support: Optimized to run Laravel or any PHP-based applications.
- Integrated Extensions:
- Database: MySQL and PostgreSQL.
- Caching: Redis and Memcached.
- Messaging: Kafka for event-driven architecture.
- Task Scheduling: Laravel Scheduler and Cron jobs support.
- Custom Configuration: Pre-configured with sensible defaults, allowing seamless customization.
- Event Handling: Support for advanced event-driven processes.
- Optimized for Microservices: Built with modern PHP microservices in mind.
This image is ideal for developers looking for a streamlined, high-performance solution to deploy PHP applications with essential tools already integrated.
- 8.4
- 8.3
- 8.2
- 8.1
- 8.0
- 7.4
- 7.2
This Docker image comes pre-installed with the following:
-
PHP Extensions:
- Composer
- OpenSSL
- XML
- PDO
- Rdkafka
- Redis
- Mbstring
- PCNTL
- ZIP
- GD
- BCMath
- Memcached
-
Additional Features:
- Laravel Cron Jobs & Scheduler
- Supervisord
- Node.js & NPM
services:
app:
image: jkaninda/nginx-php-fpm:8.3
container_name: app
restart: unless-stopped
user: www-data # Optional for production
volumes:
# Project root
- ./src:/var/www/html
ports:
- "80:80"
networks:
- default
docker compose up -d
docker compose exec app composer create-project --prefer-dist laravel/laravel .
docker compose exec app php artisan key:generate
docker compose exec app php artisan storage:link
docker compose exec app chmod -R 777 storage bootstrap/cache
docker compose exec app php artisan migrate
docker exec -it app bash
version: '3'
services:
app:
image: jkaninda/nginx-php-fpm
container_name: app
restart: unless-stopped
ports:
- "80:80"
volumes:
# Project root
- ./:/var/www/html
- ~/.ssh:/root/.ssh # Use private CVS if needed
# Optional custom PHP config
# - ./php.ini:/usr/local/etc/php/conf.d/php.ini
environment:
- APP_ENV=development # or production
- LARAVEL_PROCS_NUMBER=2 # Optional: Queue worker processes
# - CLIENT_MAX_BODY_SIZE=20M # Optional
# - DOMAIN=example.com # Optional
- DOCUMENT_ROOT=/var/www/html # Optional
/var/www/html
FROM jkaninda/nginx-php-fpm:8.3
# Copy Laravel project files
COPY . /var/www/html
# Storage Volume
VOLUME /var/www/html/storage
WORKDIR /var/www/html
# Fix permissions
RUN chown -R www-data:www-data /var/www/html
USER www-data
To enable custom Nginx configurations, use the following files:
/var/www/html/conf/nginx/nginx.conf
/var/www/html/conf/nginx/nginx-site.conf
Supervisord can be used to manage tasks or processes within the container.
[program:kafkaconsume-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/html/artisan kafka:consumer
autostart=true
autorestart=true
numprocs=1
user=www-data
redirect_stderr=true
stdout_logfile=/var/www/html/storage/logs/kafka.log
If you encounter storage permission issues, run the following commands:
docker compose exec php-fpm /bin/bash
Then inside the container:
chown -R www-data:www-data /var/www/html/
chmod -R 775 /var/www/html/storage
If you find this project useful, please give it a βοΈ on GitHub to show your support! π