Skip to content

Robust Docker image of PHP with Nginx, based on official software and supporting amd64 and arm64.

License

Notifications You must be signed in to change notification settings

fontebasso/docker-php-nginx

Repository files navigation

fontebasso/php-nginx

Docker Build Docker Pulls Signed with Sigstore SLSA Provenance GitHub License

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.

If you identify a security breach, please report it as soon as possible under the guidelines outlined in our security policy.

Features

  • Alpine Linux 3.20: Minimal base for better security and smaller footprint.
  • PHP 8.3: Modern version with performance improvements and extended support timeline.
  • Nginx: Fast and reliable web server.
  • Runit: Lightweight init system for process supervision.
  • Multi-arch builds: Supports linux/amd64 and linux/arm64.

Supply Chain Security

This image is:

  • ✅ Signed with Sigstore Cosign
  • ✅ Provenance generated in the SLSA v0.2
  • ✅ Compatible with verification using cosign verify and cosign verify-attestation

To verify the image and its provenance (example):

cosign verify \
  --certificate-identity-regexp "github.com/fontebasso/.+" \
  --certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
  docker.io/fontebasso/php-nginx@sha256:03c339da2342dd29c04a4c20da486150efc38f93a3aaf675fdf7a08899d8cb56
cosign verify-attestation \
  --type=https://slsa.dev/provenance/v0.2 \
  --certificate-identity-regexp "github.com/slsa-framework/.+" \
  --certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
  docker.io/fontebasso/php-nginx@sha256:03c339da2342dd29c04a4c20da486150efc38f93a3aaf675fdf7a08899d8cb56

No manual setup or keys required — Cosign uses GitHub Actions identity.

Getting Started

Prerequisites

  • Docker installed on your machine.
  • Docker Hub account for pulling the image.

Pulling the Image

To pull the image from Docker Hub, run:

docker pull fontebasso/php-nginx:latest

Running the Container

To run a container using this image, execute:

docker run -d -p 8080:80 fontebasso/php-nginx:latest

This will expose Nginx on port 8080 of your local machine.

Custom Configuration

You can customize the PHP configuration by editing the custom_params.ini file and copying it to the appropriate directory:

COPY ./custom_params.ini /opt/php/etc/php/conf.d/php-04-custom-params.ini

Directory Structure

  • /app: The application code.
  • /env: Environment variables directory.
  • /etc/service: Runit service definitions.

Development

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 .

Building for Multiple Architectures

This repository is configured to build for:

  • linux/amd64
  • linux/arm64

Via GitHub Actions with provenance and public signing.

Contributing

Pull requests are welcome! Please fork the repository and submit your improvements.

We follow standard open-source contribution guidelines, and are happy to receive help improving this project.

Maintainers

Contact

For questions or support, please open an issue or contact the maintainers.

License

This project is licensed under the MIT License. See the LICENSE file for details.