- Shell 53.9%
- PHP 25.7%
- Dockerfile 18.2%
- HTML 2.2%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
All checks were successful
Build images / docker (push) Successful in 7m49s
|
||
| .forgejo/workflows | ||
| conf | ||
| docs | ||
| errors | ||
| scripts | ||
| src | ||
| tests | ||
| Dockerfile | ||
| LICENSE | ||
| README.md | ||
nginx-php-fpm
Overview
This is a Dockerfile/image to build a container for nginx and php-fpm, with the ability to pull website code from git when the container is created, as well as allowing the container to push and pull changes to the code to and from git. The container also has the ability to update templated files with variables passed to docker in order to update your code and settings. There is support for lets encrypt SSL configurations, custom nginx configs, core nginx/PHP variable overrides for running preferences, X-Forwarded-For headers and UID mapping for local volume support.
If you have improvements or suggestions please open an issue or pull request on the Forgejo project page.
This is based on https://github.com/richarvey/nginx-php-fpm, but updated for modern systems and with bits I don't personally need brutally removed if they caused issues.
Versioning
| Docker Tag | Git Release | Nginx Version | PHP Version | Alpine Version |
|---|---|---|---|---|
| latest/3.5.1 | 3.5.1 | 1.30.4-r1 | 8.5.12 | 3.24.2 |
| small/3.5.1-small | 3.5.1 | 1.30.4-r1 | 8.5.12 | 3.24.2 |
| 3.5.0 | 3.5.0 | 1.30.4-r1 | 8.5.12 | 3.24.2 |
| 3.2.0 | 3.2.0 | 1.30.4-r1 | 8.2.35 | 3.24.2 |
For other tags please see: versioning
NOTE: From 3.2.0, only ARM64 builds are available.
From 3.5.1, the application port is 8080 and the nginx → PHP-FPM health endpoint is 8081/healthz. Git cloning still happens at startup in the same container. Credentials are unset before services start, and all service processes run as nginx after startup drops root.
The -small variant includes MySQLi and GD with JPEG/FreeType, plus the official PHP base's built-in modules. It omits Certbot/Let's Encrypt, MongoDB, Xdebug, nginx Lua/NDK, Composer, SSH, Supervisor, Python and the additional PostgreSQL/PDO-MySQL/Intl/XSL/SOAP/ZIP/EXIF extensions. It includes only the startup, Git-fetch and process-launcher scripts it uses. The large image retains the optional features.
Quick Start
To pull from the Forgejo registry:
docker pull git.westergaard.cloud/klafbang/nginx-php-fpm:latest
Running
To simply run the container:
docker run -d -p 8080:8080 git.westergaard.cloud/klafbang/nginx-php-fpm
To dynamically pull code from git when starting:
docker run -d -p 8080:8080 -e 'GIT_EMAIL=email_address' -e 'GIT_NAME=full_name' -e 'GIT_USERNAME=git_username' -e 'GIT_REPO=github.com/project' -e 'GIT_PERSONAL_TOKEN=<long_token_string_here>' git.westergaard.cloud/klafbang/nginx-php-fpm:latest
You can then browse to http://<DOCKER_HOST>:8080 to view the default install files. To find your DOCKER_HOST use the docker inspect to get the IP address (normally 172.17.0.2)
For more detailed examples and explanations please refer to the documentation.
Documentation
- Building from source
- Versioning
- Config Flags
- Git Auth
- Git Commands
- Push
- Pull
- Repository layout / webroot
- webroot
- User / Group Identifiers
- Custom Nginx Config files
- REAL IP / X-Forwarded-For Headers
- Scripting and Templating
- Environment Variables
- Lets Encrypt Support
- Setup
- Renewal
- PHP Modules
- Xdebug
- Logging and Errors