https://github.com/factorysh/docker-php
Dockerfile for PHP
https://github.com/factorysh/docker-php
docker php
Last synced: 4 months ago
JSON representation
Dockerfile for PHP
- Host: GitHub
- URL: https://github.com/factorysh/docker-php
- Owner: factorysh
- License: gpl-3.0
- Created: 2017-10-27T09:32:18.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-04-15T13:48:55.000Z (about 4 years ago)
- Last Synced: 2024-04-21T00:58:39.840Z (about 2 years ago)
- Topics: docker, php
- Language: HTML
- Size: 635 KB
- Stars: 2
- Watchers: 4
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
PHP docker images by bearstech
===============================
3 variants of PHP7 from Debian :
- composer: [bearstech/php-composer](https://hub.docker.com/r/bearstech/php-composer/)
- cli: [bearstech/php-cli](https://hub.docker.com/r/bearstech/php-cli/)
- fpm: [bearstech/php](https://hub.docker.com/r/bearstech/php/)
All variants are available as tag for PHP 7.0, 7.1, 7.2 and 7.3
Dockerfiles
-----------
Dockerfiles are available at https://github.com/factorysh/docker-php
Usage
-----
```
docker run --rm bearstech/php:7.3
docker run --rm bearstech/php-cli:7.3
docker run --rm bearstech/php-composer:7.3
```
Composer
--------
In `bearstech/php-composer` images, `composer` is the latest stable version : 2.x now.
The `composer1` command is here to help your migration to *Composer 2*, `composer1` version 1.10.x.
User
----
fpm images needs a specific user, not root.
In your `Dockerfile`, use something like :
```
RUN useradd alice --shell /bin/bash
COPY www /var/www/web
USER alice
```
If you are using a `volume`, be carefuls with uids :
```
ARG UID=1001
RUN useradd alice --uid ${UID} --shell /bin/bash
COPY www /var/www/web
USER alice
```
and build the image with a `build-arg` like :
```
--build-arg UID=`id -u`
```
Session
-------
Default session handler is a file.
If you set `SESSION_REDIS_URL`, the will use Redis as a session handler.
See https://github.com/phpredis/phpredis
Entrypoint.d
------------
All php images implements the concept of `entrypoint.d`.
With `entrypoint.d` user can trigger custom actions before application startup
(entrypoint).
Just put your scripts and executable in the `/entrypoint.d` directory of your php
containers. On startup, each executable file inside this directory will be
run in an independent bash process.
Entrypoint.d runs files marked as executable, in **alphabetical order**. You can look
for an example inside `/entrypoint.d`
Since each container runs `entrypoint.d` scripts, this is not **the
recommanded way** to run migrations :
**if you have N replicas, migrations will be run N times**