This repository contains a Docker image for running high-performance PHP web applications. It is optimized for speed, efficiency, and includes a comprehensive set of tools and libraries commonly used in web development.
This image is ready to run in production, suggestions for improvements and corrections are very welcome, see how to contribute.
If you identify a security breach, please report it as soon as possible under guidelines outlined in our security policy.
- PHP 8.2: The image uses PHP 8.2, which is optimized for performance and includes numerous features and improvements.
- Alpine Linux 3.16: A minimal Docker image based on Alpine Linux for security and reduced image size.
- Nginx: Fast and reliable web server.
- Essential PHP Extensions: Including
bcmath
,bz2
,calendar
,exif
,gd
,opcache
,pdo_mysql
,shmop
,sockets
,sysvmsg
,sysvsem
,sysvshm
,pcntl
,zip
, andimagick
. - Pre-installed Libraries:
git
,bzip2-dev
,freetype-dev
,icu-dev
,imagemagick
,jpeg-dev
,libpng-dev
,libressl-dev
,libxml2-dev
,libzip-dev
,oniguruma-dev
and more. - Runit: Lightweight and easy-to-use init system.
- Docker installed on your machine.
- Docker Hub account for pulling the image.
To pull the image from Docker Hub, run:
docker pull fontebasso/php-nginx:latest
To run a container using this image, execute:
docker run -d -p 8080:80 fontebasso/php-nginx:latest
This command will start a container and map port 8080 on your local machine to port 80 on the container.
You can customize the PHP configuration by editing the custom_params.ini file and copying it to the appropriate directory:
COPY ./custom_params.ini /usr/local/etc/php/conf.d/docker-php-ext-x-02-custom-params.ini
/app
: The application code./env
: Environment variables directory./var/log/nginx
: Nginx logs./etc/service
: Service definitions forrunit
.
To build the Docker image locally, clone this repository and run:
git clone https://github.com/fontebasso/docker-php-nginx.git
cd docker-php-nginx
docker build -t fontebasso/php-nginx:latest .
This repository is configured to build for multiple architectures using GitHub Actions. Supported architectures:
linux/amd64
linux/arm64
Contributions are welcome! Please fork this repository and submit a pull request with your changes.
For questions or support, please open an issue or contact the maintainers.
This project is licensed under the MIT License. See the LICENSE file for details.