https://github.com/greg0/php-runtime-env
docker-compose environment for PHP app local development
https://github.com/greg0/php-runtime-env
Last synced: 4 months ago
JSON representation
docker-compose environment for PHP app local development
- Host: GitHub
- URL: https://github.com/greg0/php-runtime-env
- Owner: Greg0
- Created: 2018-02-18T17:08:10.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-01-10T22:27:02.000Z (over 2 years ago)
- Last Synced: 2025-10-07T20:44:53.531Z (9 months ago)
- Language: Dockerfile
- Size: 55.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Image build
===========
```shell
make build image=php8.0
```
Docker-compose
==============
Put your PHP application into `src/` and public files (e.g. `index.php`) into `src/public/`
[Makefile](`Makefile`) provides shortcuts. Argument `php` is optional
```shell
make start php=8.0
```
For xdebug images
```shell
make debug php=8.0
```
To stop containers
```shell
make stop
```
Files organization
==================
Nginx listening for files in `src/public/` on port `8080`.
Composer
========
To run composer inside container exec
```
docker exec -it project_dir_php_1 composer install
```
or use official composer image https://store.docker.com/images/composer
> Note: Official composer image is used unside `php` container.
Permissions in linux volumes
===========================
For fresh docker installation read [Post-installation steps for Linux](https://docs.docker.com/install/linux/linux-postinstall/)
To avoid permissions issues follow instructions from article
"[Use Linux user namespaces to fix permissions in docker volumes](https://www.jujens.eu/posts/en/2017/Jul/02/docker-userns-remap/)"
#### TL;DR;
Word `USER` in listings should be replaced by your system user name: `id -u -n`
1. Create or add to existing file `/etc/docker/daemon.json`
```json
{
"userns-remap": "USER"
}
```
2. Edit file `/etc/subuid`
```
USER:1000:1
USER:100000:65536
```
3. Edit file `/etc/subgid`
```
USER:996:1
USER:100000:65536
```
Replace `996` with value returned by command `getent group docker`
---
Instead of above you can also often run
```shell
chown $(id -un) -R .
```