https://github.com/timo-reymann/php-app
Docker image for running PHP apps in a single container with nginx and PHP-fpm
https://github.com/timo-reymann/php-app
docker nginx php
Last synced: 3 months ago
JSON representation
Docker image for running PHP apps in a single container with nginx and PHP-fpm
- Host: GitHub
- URL: https://github.com/timo-reymann/php-app
- Owner: timo-reymann
- License: mit
- Created: 2022-12-07T16:49:28.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2026-03-28T23:11:08.000Z (3 months ago)
- Last Synced: 2026-03-29T01:42:59.792Z (3 months ago)
- Topics: docker, nginx, php
- Language: Dockerfile
- Homepage: https://hub.docker.com/r/timoreymann/php-app
- Size: 165 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Notice: NOTICE
Awesome Lists containing this project
README
php-app
===
[](https://github.com/timo-reymann/php-app/blob/main/LICENSE)
[](https://github.com/timo-reymann/php-app/releases)
[](https://hub.docker.com/r/timoreymann/php-app)
[](https://renovatebot.com)
[](https://github.com/timo-reymann/php-app/actions/workflows/main.yml)
Docker image for running PHP apps in a single container with nginx and PHP-fpm
## Features
- Running as non-root
- Run PHP apps with secure defaults
## Requirements
- [Docker](https://docs.docker.com/get-docker/)
## Usage
### Basic
For basic usage with no further extensions, you just copy your sources to /app
```Dockerfile
FROM timoreymann/php-app
COPY --chown=application:application ./code /app
```
### Build your image with sources and install composer dependencies
When you use composer for external dependencies you can easily install them in the build process.
The `composer-install` script downloads the installer from GitHub, installs the depencies and removes the phar file.
```Dockerfile
FROM timoreymann/php-app
WORKDIR /app
COPY --chown=application:application ./code ./
RUN composer-install
```
### Configure index.php for PHP-based routing
When you build a modern web app with PHP, chances are high that you will have routing within your index.php.
To make it work, nginx needs to route all requests to the index.php, if the file does not exist in the webroot (e.g. assets).
```Dockerfile
FROM timoreymann/php-app
WORKDIR /app
COPY --chown=application:application ./code ./
RUN composer-install && configure-index-rewrite
```
## Documentation
### Components
The image consists of:
- multirun - Small util for executing multiple processes with proper signal handling
- PHP 8 FPM - Execution of PHP files
- nginx - Serve evaluated files from FPM
PHP 8 extensions that are common are also pre-installed:
- curl
- ctype
- dom
- freetype
- gd
- jpeg
- mysqli
- mbstring
- opcache
- openssl
- pdo
- pdo_mysql
- phar
- simplexml
- xml
- zip
### Ports
- 8080: HTTP-Server
## Contributing
I love your input! I want to make contributing to this project as easy and transparent as possible, whether it's:
- Reporting a bug
- Discussing the current state of the configuration
- Submitting a fix
- Proposing new features
- Becoming a maintainer
To get started please read the [Contribution Guidelines](./CONTRIBUTING.md).
## Development
### Requirements
- [Docker](https://docs.docker.com/get-docker/)