https://github.com/at-cloud-pro/caddy-php-image
High-performance scaffold image of PHP server using Caddy runner. Common image for many of my private and commercial apps.
https://github.com/at-cloud-pro/caddy-php-image
devops
Last synced: 5 months ago
JSON representation
High-performance scaffold image of PHP server using Caddy runner. Common image for many of my private and commercial apps.
- Host: GitHub
- URL: https://github.com/at-cloud-pro/caddy-php-image
- Owner: at-cloud-pro
- License: mit
- Created: 2022-07-27T07:56:37.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-02-25T22:01:24.000Z (over 2 years ago)
- Last Synced: 2024-02-26T22:25:09.652Z (over 2 years ago)
- Topics: devops
- Language: Dockerfile
- Homepage:
- Size: 36.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/at-cloud-pro/caddy-php-image/actions/workflows/workflow.yaml)
# Caddy PHP Image
This is a scaffold image of high-performance PHP server using Caddy and php-fpm daemon. It's common image for my
internal and external projects as it contains all the PHP server setup and configuration in one place.
## What's inside
The package uses as a base `php:8.3-alpine3.19` image, and adds:
* fully-configured Caddy runner with php-fpm daemon
* PHP extensions required by Symfony (`intl`, `pdo_mysql`, `pdo_pgsql`, `redis`, `sodium`)
* PHP extensions required for maximum application performance (`opcache`, `zip`, `apcu`)
* Composer package manager with cache optimizations (local OS cache is bind)
* php-fpm configuration for maximum performance
* Configured and ready to use Xdebug debugger
## How to use this image
The simplest possible way of implementing it is shown below. Let's assume you have a Symfony (PHP) project with
structure as follows:
```
my-awesome-project
└───.idea
└───.git
└───.github
└───app
│ └───bin
│ └───config
│ └───public
│ └───src
│ └───tests
│ └───var
│ └───vendor
│ │ composer.json
│ │ composer.lock
│ Dockerfile
```
Content of your Dockerfile:
```dockerfile
FROM ghcr.io/at-cloud-pro/caddy-php:4.0.0 AS app
COPY ./app /app
RUN composer install
USER www-data:www-data
```
In Dockerfile shown above you're just copying `app` folder, and you're all set. You may install Composer packages or do
other actions that your application requires to run - it's extensive.
Last line is recommended to avoid privilege issues on files created in container by other processes.
## Changelog
Changelog is available [here](CHANGELOG.md). Please update changelog each time commission is made. I adapted
[semantic versioning](https://semver.org/) in this repository, and this versioning practice should be used.